﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
using System.Security.Cryptography;
using ZHDJ.Data.BLL;
using ZHDJ.Core;
using ZHDJ.Core.Util;
using MySql.Data.MySqlClient;
//using SXT.Utility;
//using SXT.Party.Utility;

namespace ZHDJ.MobileInterface
{
    public class InterfaceHelper
    {
        //        #region 通用判断方法

        //        /// <summary>
        //        /// 检查用户是否存在系统 true 存在  false 不存在
        //        /// </summary>
        //        /// <param name="LoginID"></param>
        //        /// <returns></returns>
        //        public static bool CheckLoginIDInSystem(string LoginID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sql = "select * from tblPartyOrgMembers where LoginID='" + LoginID + "'";
        //                cmd.CommandText = sql;
        //                DataSet ds = DB.DBManager.DefaultDB.ExecuteDataSet(cmd);
        //                if (ds.Tables[0].Rows.Count > 0)
        //                { return true; }
        //                else return false;
        //            }
        //        }

        //        /// <summary>
        //        /// 是否党员
        //        /// </summary>
        //        /// <param name="LoginID"></param>
        //        /// <param name="IsMobile"></param>
        //        /// <returns></returns>
        //        public static bool IsPartyMember(string LoginID, string IsMobile = "")
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@" select count(*) from tblpartyorgmembers where runSate=0 and loginid=@loginid");
        //                    cmd.Parameters.Add("@loginid", SqlDbType.NVarChar).Value = LoginID;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;
        //                    if (string.IsNullOrEmpty(IsMobile))
        //                    {
        //                        o = DBManager.DefaultDB.ExecuteScalar(cmd);
        //                    }
        //                    else
        //                    {
        //                        o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);
        //                    }
        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        #endregion


        //        #region 个人信息
        //        #region 获取党务工作者
        //        public static string GetstreetBranchID(string streetName)
        //        {
        //            string sql = "";
        //            sql = string.Format(@" select BranchID  from tblPartyOrgBranch 
        //where ParentBranchID='D658070EC3BF425BA8417745FDCBFCB0' and  BranchName like '%街%' and (replace(BranchName,'党工委','')='{0}' or BranchID='{0}')", streetName);

        //            object o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql);
        //            return o != null ? o.ToString() : "";
        //        }
        //        public static string GetBranchLeader(string branchID)
        //        {
        //            string sql = "";
        //            if (!string.IsNullOrEmpty(branchID))
        //            {
        //                sql = string.Format(@" select LoginID from tblPartyOrgMembers where BranchID='{0}' and IsPartyWorker=1 ", branchID);
        //            }
        //            else
        //            {
        //                sql = @"SELECT om.LoginID FROM dbo.tblPartyOrgMembers om 
        //                        INNER JOIN dbo.tblPartyOrgBranch ob ON om.BranchID = ob.BranchID
        //                        WHERE ISNULL(ob.ParentBranchID, '') = '' AND om.IsPartyWorker = 1";
        //            }
        //            object o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql);
        //            return o != null ? o.ToString() : "";
        //        }
        //        #endregion

        //        #region 判断用户是否是党员
        //        public static bool CheckUserIsParty(string userID)
        //        {
        //            string sqlLoginID = "select runSate from tblPartyOrgMembers where LoginID ='" + userID + "'";
        //            object obj = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID);

        //            if (obj == null)
        //                return false;

        //            if (obj.ToString() == "-1")
        //                return false;
        //            else
        //                return true;
        //        }
        //        #endregion

        //#region 修改的用户名是否可用
        //public static bool UserNameIsAbleUpdate(string userID, string newUserName)
        //{
        //    string sqlLoginID = "select count(LoginID) from tblPartyOrgMembers where LoginID !='" + userID + "' and LoginID='" + newUserName + "'";
        //    if (Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID)) > 0)
        //        return false;


        //    sqlLoginID = "select count(NewLoginID) from dbo.tblOrgUser where loginid !='" + userID + "' and NewLoginID ='" + newUserName + "'";
        //    if (Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID)) > 0)
        //        return false;
        //    else
        //        return true;
        //}
        //#endregion

        //        #region 判断姓名是否存在
        //        public static bool CheckName(string Name)
        //        {
        //            string sqlName = " select count(UserName) from tblPartyOrgMembers where UserName ='" + Name + "'";
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlName)) > 0;
        //        }
        //        #endregion

        #region 判断用户ID是否存在
        public static bool CheckLoginIDCountEx(string userID)
        {
            string sqlLoginID = "select count(LoginID) from tblpartyorgmember where LoginID ='" + userID + "'";
            return Convert.ToInt32(ZHDJ.Data.MySqlHelper.ExecuteScalar(sqlLoginID)) > 0;
        }
        #endregion

        //        #region 判断身份证号码是否存在
        //        public static bool CheckIdentityCardIsExists(string IdentityCard)
        //        {
        //            string sqlLoginID = "select count(IdentityCard) from tblPartyOrgMembers where IdentityCard ='" + IdentityCard + "'";
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID)) > 0;
        //        }
        //        #endregion

        //        #region 判断手机号码是否存在
        //        public static bool CheckMobileNoIsExists(string mobileNo)
        //        {
        //            string sqlLoginID = "select count(MobileNo) from tblPartyOrgMembers where MobileNo ='" + mobileNo + "'";
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID)) > 0;
        //        }
        //        #endregion

        //        #region 是否可以查询组织代办
        //        public static string IsAbleQueryBranchTask(string userID)
        //        {
        //            string brandList = "''";
        //            string sql = "select IsPartyWorker,BranchID from tblPartyOrgMembers a where LoginID='" + userID + "'";
        //            DataSet ds = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //            if (ds != null && ds.Tables[0].Rows.Count > 0)
        //            {
        //                foreach (DataRow item in ds.Tables[0].Rows)
        //                {
        //                    if (item["IsPartyWorker"].ToString().ToLower() == "true")
        //                        brandList += ",'" + item["BranchID"].ToString() + "'";
        //                }
        //            }

        //            sql = " select BranchID from tblPartyOrgBranchAdmin where loginid='" + userID + "'";
        //            DataSet dsT = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //            if (dsT != null && dsT.Tables[0].Rows.Count > 0)
        //            {
        //                foreach (DataRow item in dsT.Tables[0].Rows)
        //                {
        //                    brandList += ",'" + item["BranchID"].ToString() + "'";
        //                }
        //            }

        //            return brandList;
        //        }
        //        #endregion

        #region 根据查询条件获取个人用户信息
        public static DataSet GetMembersByFilter(string filter)
        {
            string sql = "select * from tblpartyorgmember";

            sql += " where " + filter;
            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
        }
        #endregion

        #region 个人信息查询接口
        /// <summary>
        /// 个人信息查询接口
        /// </summary> 
        /// <returns></returns>
        public static DataSet GetMembersInfo(string loginID)
        {
            string dtStr = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
            string brandID = "";// InterfaceHelper.IsAbleQueryBranchTask(loginID);

            string sql = string.Format(@"SELECT '' AS analysis_reports,om.BranchID AS branch_id,brand.ImageUrl AS branch_img,  
	(SELECT MAX(bscore2.score) FROM tblpartyscorerankbranch bscore2 WHERE bscore2.BranchID = om.BranchID) AS branch_int, 
	brand.BranchName AS branch_name,(SELECT COUNT(*) FROM tblpartyorgmember WHERE BranchID=om.BranchID AND runSate='0' ) AS branch_peoples,	
	(SELECT mscore3.branchrank FROM tblpartyscorerankmember mscore3 WHERE mscore3.loginid = om.LoginID) AS branch_rank,
        (SELECT bscore1.rank FROM tblpartyscorerankbranch bscore1 WHERE bscore1.BranchID = om.BranchID) AS rank_num, 
        (SELECT orgmemberEx.username FROM tblpartyorgleader leader INNER JOIN tblpartyorgmember orgmemberEx ON orgmemberEx.loginid=leader.loginid  
        WHERE leader.BranchID=om.BranchID AND leader.PostCategory ='0') AS branch_sec, 
        '' AS check_dept,om.UserName AS cname,om.Address AS contact_addr,om.Email AS email,om.ImageUrl AS head_img, 
	om.IdentityCard AS idcard,
	(SELECT mscore2.rank FROM tblpartyscorerankmember mscore2 WHERE mscore2.loginid = om.LoginID) AS integral_rank,
        (SELECT mscore1.score FROM tblpartyscorerankmember mscore1 WHERE mscore1.loginid = om.LoginID) AS integral_total,
        (SELECT IFNULL(SUM(tblpartyobjectscore.Score),0) FROM tblpartyobjectscore WHERE tblpartyobjectscore.objecttype = 'Member' 
        AND tblpartyobjectscore.ObjectID=om.LoginID AND tblpartyobjectscore.category='PartyOnlineTest' 
        AND tblpartyobjectscore.ScoreDate=NOW()) AS is_can_test,(CASE om.IsPartyWorker WHEN '1' THEN '1' ELSE '0' END) AS is_party_workers,	
        om.Post AS job, om.JoinPartyDate AS join_time, om.MobileNo AS mobile,DATEDIFF (JoinPartyDate, NOW()) AS part_age,
        '' AS party_stu_url, om.QQNumber AS qq ,'' AS reg_dept, om.UserNo AS user_name,
        0 AS todos,
        0 AS todosEx,	
        0 AS metting_signs,	
        0 AS metting_signs_qd,
        0 AS metting_signs_b,	
        0 AS metting_signs_qd_b,
        0 AS metting_signs_c,	
        0 AS metting_signs_qd_c  
        FROM tblpartyorgmember om 
        LEFT JOIN tblpartyorgbranch brand ON om.BranchID = brand.BranchID  
        WHERE om.LoginID='{0}'", loginID);

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
        }
        #endregion

        //        #region 修改个人信息接口
        //        /// <summary>
        //        /// 修改个人信息接口
        //        /// </summary>
        //        /// <param name="memberInfo"></param>
        //        /// <returns></returns>
        //        public static bool UpdateMembersInfo(MembersInfoEditInParam memberInfo)
        //        {
        //            //上传文件
        //            string fileID = "";

        //            if (!string.IsNullOrEmpty(memberInfo.head_img) && !string.IsNullOrEmpty(memberInfo.head_filename))
        //                fileID = CommonUtils.UploadImagFile(memberInfo.head_img, memberInfo.head_filename);

        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"update tblPartyOrgMembers set UserName=@UserName,MobileNo=@MobileNo,
        //Email=@Email,QQNumber=@QQNumber,Address=@Address ";

        //                if (!string.IsNullOrEmpty(fileID))
        //                {
        //                    cmd.CommandText += ",ImageUrl=@ImageUrl";
        //                    cmd.Parameters.Add("@ImageUrl", System.Data.SqlDbType.VarChar).Value = fileID;
        //                }
        //                cmd.CommandText += " where LoginID = @LoginID ";

        //                cmd.Parameters.Add("@UserName", System.Data.SqlDbType.VarChar).Value = memberInfo.user_name;
        //                cmd.Parameters.Add("@MobileNo", System.Data.SqlDbType.VarChar).Value = string.IsNullOrEmpty(memberInfo.mobile) ? "" : memberInfo.mobile;
        //                cmd.Parameters.Add("@Email", System.Data.SqlDbType.VarChar).Value = string.IsNullOrEmpty(memberInfo.email) ? "" : memberInfo.email;
        //                cmd.Parameters.Add("@QQNumber", System.Data.SqlDbType.VarChar).Value = string.IsNullOrEmpty(memberInfo.qq) ? "" : memberInfo.qq;
        //                cmd.Parameters.Add("@Address", System.Data.SqlDbType.VarChar).Value = string.IsNullOrEmpty(memberInfo.contact_addr) ? "" : memberInfo.contact_addr;
        //                cmd.Parameters.Add("@LoginID", System.Data.SqlDbType.VarChar).Value = string.IsNullOrEmpty(memberInfo.user_id) ? "" : memberInfo.user_id;


        //                return SXT.DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }


        public static bool UpdateMembersInfoNew(MembersInfoEditInParam memberInfo, string fileID)
        { 

            //if (!string.IsNullOrEmpty(memberInfo.head_img) && !string.IsNullOrEmpty(memberInfo.head_filename))
            //    fileID = CommonUtils.UploadImagFile(memberInfo.head_img, memberInfo.head_filename);

            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandText = @"update tblpartyorgmember set MobileNo='"+(string.IsNullOrEmpty(memberInfo.mobile) ? "" : memberInfo.mobile) +"' ";

                if (!string.IsNullOrEmpty(fileID))
                {
                    cmd.CommandText += ",ImageUrl='"+ fileID + "'"; 
                }

                if (!string.IsNullOrEmpty(memberInfo.user_name))
                {
                    cmd.CommandText += ",UserName='"+ memberInfo.user_name + "'"; 
                }

                    cmd.CommandText += " where LoginID = '"+ memberInfo.user_id + "';"; 

                return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(cmd.CommandText) > 0;
            }
        }
        //        #endregion

        #region 登陆密码是否正确
        /// <summary>
        /// 登陆密码是否正确
        /// </summary> 
        /// <param name="loginID">用户登陆名</param>
        /// <param name="password">密码</param> 
        /// <returns></returns>
        public static bool PasswordIsCorrect(string loginID, string password)
        {
            string sql = " select Password from tblpartyorgmember where LoginID='" + loginID + "'";
            object obj = Data.MySqlHelper.ExecuteScalar(sql);

            if (obj == null)
                return false;
             
            if (ZHDJ.Core.Util.PasswordUtil.ComparePasswords(obj.ToString(), password))
                return true;
            else
                return false;
        }
        #endregion

        #region 修改密码
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="loginID">用户登陆名</param>
        /// <param name="password">经过md5加密的密码</param>
        /// <returns></returns>
        public static bool UpdatePassword(string loginID, string password)
        {
            string sql = "update tblpartyorgmember set Password = '" + password + "' where LoginID='" + loginID + "'";

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 支部通讯录联系人信息列表
        /// <summary>
        /// 支部通讯录联系人信息列表
        /// </summary>
        /// <param name="type">类别 1：支部通讯录，此时需要传入支部ID，2：党务工作通讯录，则不需要传入支部ID参数，</param>
        /// <param name="branch_id">支部ID</param>
        /// <param name="keyword">联系人姓名关键字 如有为空则查询所有，关键字为用户名，手机号码，所属组织</param>
        /// <param name="page_no">当前页</param>
        /// <param name="page_count">每页记录条数</param>
        /// <returns></returns>
        public static DataSet GetBranchAddressList(string type, string branch_id, string keyword, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;
            string url = string.Empty;

            if (type == "1")
            {
                where = "om.BranchID='" + branch_id + "'";
            }
            else
            {
                where = "om.IsPartyWorker='1'";
            }

            if (!string.IsNullOrEmpty(keyword))
            {
                where += string.Format(" and (om.UserName like '%{0}%' or om.MobileNo like '%{0}%' or ob.BranchName like '%{0}%') ", keyword);
            }

            field = "om.LoginID as user_id,om.UserName as cname, om.MobileNo as mobile,ob.BranchID as branch_id, ob.BranchName as branch_Name";
            table = "tblpartyorgmember om left join tblPartyOrgBranch ob on om.BranchID = ob.BranchID";
            orderBy = "om.UserName ";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        //        #region 用户登录
        public static string GetLoginID(string loginID)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                //根据新登录ID取旧登录ID
                string sql = " select LoginID from tblpartyorgmember where Userno = '"+ loginID + "' "; 
                object o =Data.MySqlHelper.ExecuteScalar(sql);
                if (o != null)
                {
                    return o.ToString();
                }
                else
                {
                    return "";
                }
            }
        }

        public static bool LoginIDEnable(string loginID)
        {
            string sql = " select IsAgree from tblpartyorgmember where LoginID= '" + loginID + "'";
            return Convert.ToBoolean(Data.MySqlHelper.ExecuteScalar(sql));
        }

        public static DataSet GetMembersLoginInfo(string loginID)
        {
            string sql = string.Format(@"select Birthday, JoinPartyDate, LoginID as user_id,userno as user_name, UserName as user_truename, BranchID as branch_id, 
        (case runSate when '-1' then '2' else '1' end) as user_type ,
        (select IFNULL(SUM(Score),0) from tblPartyObjectScore where objecttype = 'Member' 
        and ObjectID=om.LoginID and category='PartyOnlineTest' and ScoreDate=now()) as is_can_test,
        '' as party_url,'' as person_url,'' as join_url
        from tblpartyorgmember om where LoginID='{0}'", loginID);

            return Data.MySqlHelper.ExecuteDataSet(sql);
        }
        //        #endregion

        //        #region 用户注册
        //        public static string CheckLoginID(string loginID)
        //        {
        //            string sqlLoginID = "select count(NewLoginID) from dbo.tblOrgUser where NewLoginID like'" + loginID + "%'";
        //            int count = Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID));
        //            if (count > 0)
        //            {
        //                loginID += (count + 1).ToString();
        //            }
        //            return loginID;
        //        }

        //        public static bool CheckLoginIDCount(string loginID)
        //        {
        //            string sqlLoginID = "select count(NewLoginID) from dbo.tblOrgUser where NewLoginID ='" + loginID + "'";
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID)) > 0;
        //        }

        //        public static bool InsertMembers(UserRegisterInParam param)
        //        {
        //            string sql = string.Format(@"insert into tblPartyOrgMembers(LoginID,BranchID,UserName,IdentityCard,MobileNo,
        //QQNumber,Gender,IsFirstLogin,runSate,IsAgree,Birthday,
        //BeRegularDate,JoinPartyDate,pwdOverTime,Password, OrderNo, IsPartyWorker, UserType, WorkAddress, CensusAddress,Email,WorkUnit,UnitJob)
        //values('{0}','','{1}','{2}','{3}',
        //'{4}','1','1','-1','1','1753-01-01',
        //'1753-01-01','1753-01-01','1753-01-01','{5}', '0','0','{6}','{7}','{8}','{9}','{11}','{12}');
        //update tblOrgUser set NewLoginID='{10}' where LoginID='{0}'", param.user_name, param.cname, param.idcard, param.mobile,
        //                                              "", param.pwd, param.UserType, param.WorkAddress, param.CensusAddress, param.Email,param.user_name,param.WorkUnit,param.UnitJob);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 获取用户信息
        //        public static DataSet GetUseInfo(string loginID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sql = " select * from tblPartyOrgMembers where LoginID = @loginID ";
        //                cmd.Parameters.Add("@loginID", SqlDbType.NVarChar).Value = loginID;
        //                cmd.CommandText = sql;
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 获取指定单位的人员（包括所有下级单位）
        //        public static DataSet GetAllUserByBranch(string filds, string branchID)
        //        {
        //            string sql = string.Format(@"select {0}
        //from tblPartyOrgMembers a left join tblPartyOrgBranch b on a.BranchID=b.BranchID
        //where a.BranchID in( 
        //select id from f_BranchID('{1}')) and a.BranchID !='{1}'", filds, branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion
        //        #endregion

        //        #region 微信接口
        //        #region 组织是否存在
        //        public static string GetBranchID(string brand)
        //        {
        //            string sql = string.Format(" select BranchID from tblPartyOrgBranch where BranchID= '{0}' or BranchName = '{0}'", brand);

        //            object obj = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql);

        //            if (obj == null)
        //                return "";
        //            else
        //                return obj.ToString();
        //        }
        //        #endregion

        //        #region 微信号绑定
        //        public static bool WXIsHaveBinding(string loginID, string openid)
        //        {
        //            string sql = string.Format("select * from tblPartyWXBinding where loginID='{0}' or openid='{1}' ", loginID, openid);
        //            DataSet ds = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);

        //            if (ds == null || ds.Tables[0].Rows.Count == 0)
        //            { return false; }
        //            else
        //            { return true; }
        //        }

        //        public static bool WXIsHaveBindingEx(string loginID, string openid)
        //        {
        //            string sql = string.Format("select * from tblPartyWXBinding where loginID='{0}' and openid='{1}' ", loginID, openid);
        //            DataSet ds = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);

        //            if (ds == null || ds.Tables[0].Rows.Count == 0)
        //            { return false; }
        //            else
        //            { return true; }
        //        }

        //        public static bool BindingWX(string loginID, string openid)
        //        {
        //            string sql = string.Format(@"insert into tblPartyWXBinding(ID, LoginID, Openid,CreateTime)
        //                                        values(REPLACE(NEWID(), '-', ''), '{0}', '{1}','{2}') ", loginID, openid, DateTime.Now);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }

        //        public static bool BindingWXDel(string loginID, string openid)
        //        {
        //            string sql = string.Format(@"delete from tblPartyWXBinding where LoginID = '{0}' and Openid='{1}' ", loginID, openid);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 流动党员找组织信息提交接口
        //        public static bool PartyFindBranch(string Name, string Sex, string IDNum, string QQ, string ReAddress, string contact,
        //            string branchId, string FrAddress, string education, string Job, string PartyNum, string InTime, string WrAddress, string birth, string Age, string id)
        //        {
        //            string sql = string.Format(@"insert into tblPartyFindBranch(ID,UserName,Sex,IDCard,QQ,
        //                                            Address, MobileNumber, Description, Status, BranchID,
        //                                            NativePlace,Nation,Educational,Title,PartyCardNo,
        //                                            JoinPartyDate,PartyJobAdderss,CreateTime,Birthday,Age)
        //                                            values('{15}', '{0}', '{1}', '{2}', '{3}',
        //                                            '{4}', '{5}', '', '提交申请', '{6}',
        //                                            '{7}','{7}','{8}','{9}', '{10}',
        //                                            '{11}', '{12}', GETDATE(), '{13}','{14}')",
        //                         Name, Sex, IDNum, QQ, ReAddress, contact, branchId, FrAddress, education, Job, PartyNum, InTime, WrAddress, birth, Age, id);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 获取党代表最新动态信息列表
        //        public static DataSet GetXHPartyMeetingList(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"a.title,b.BranchName as receive_team, a.BranchID as branch_id,b.BranchName as branch_name,
        //a.MeetTime as receive_time, a.PartyDeputyName as receive_actor, a.Address, a.MeetContent as context,
        //a.SignX as X, a.SignY as Y";
        //            table = @"tblXHPartyMeetingInfo a left join tblPartyOrgBranch b on a.BranchID=b.BranchID";
        //            where = "a.IsShow ='1'";
        //            orderBy = "a.MeetTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取代表团信息
        //        /// <summary>
        //        /// 获取代表团信息
        //        /// </summary>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetXHPartyMissionList(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"data.BranchID,data.BranchName,data.BranchType,data.Description,data.Address,bs.DeputyImageID as Image_url,bs.DeputyStudioPhone";
        //            table = @"tblPartyOrgBranch data left join tblPartyOrgBranchSetting bs on(bs.BranchID=data.BranchID) ";
        //            where = "BranchMark=2 and BranchName like '%街党工委%' ";
        //            orderBy = "OrderNo";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }

        //        #endregion

        //        #region 获取组织党代表信息
        //        /// <summary>
        //        /// 获取组织党代表信息
        //        /// </summary>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetXHPartyRepresentativeList(int page_no, int page_count, string BranchID)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = "UserName,LoginID,BranchID,DeputyTypeName,ImageUrl";
        //            table = string.Format(@"(select data.UserName,data.LoginID,data.BranchID,'{0}' as DeputyBranchID,data.Post,data.ImageUrl,DeputyTypeName='本单位代表',DeputyType='1','' as ExternalID,pon.OrderNo ,Case when pon.OrderNo is null then '0' else '1' end as HasOrder from tblPartyOrgMembers data
        //                                left join tblPartyOrderNo pon on (pon.ObjectID=data.LoginID and pon.Category='党代表直通车' and pon.CategoryGroupby='{0}')
        //                                where 1 = 1 and isPartyDeputy='1' and runSate='0' and BranchID in (select id from f_BranchID('{0}')) 	
        //                                union 
        //                                select data.username,ex.LoginID,ex.BranchID,'{0}' as DeputyBranchID,data.Post,data.ImageUrl,DeputyTypeName='本单位代表',DeputyType='1',ex.ExternalID,pon.OrderNo ,Case when pon.OrderNo is null then '0' else '1' end as HasOrder from tblPartyDeputyExternal ex
        //                                left join dbo.tblPartyOrgMembers data on (ex.LoginID=data.LoginID)
        //                                left join tblPartyOrderNo pon on (pon.ObjectID=ex.LoginID and pon.Category='党代表直通车' and pon.CategoryGroupby='{0}')
        //                                where data.runSate='0' and ex.BranchID= '{0}' and ex.Category<>'QuWai'
        //                                union
        //                                 select ex.name as username, ex.LoginID,ex.BranchID,'{0}' as DeputyBranchID, ex.Post,me.ImageUrl as ImageUrl ,DeputyTypeName='外单位代表',DeputyType='0',ex.ExternalID,pon.OrderNo ,Case when pon.OrderNo is null then '0' else '1' end as HasOrder  from tblPartyDeputyExternal ex
        //                               left join dbo.tblPartyOrgMembers me on (ex.LoginID=me.LoginID)
        //                                left join tblPartyOrderNo pon on (pon.ObjectID=ex.ExternalID and pon.Category='党代表直通车' and pon.CategoryGroupby='{0}')
        //                                where ex.BranchID= '{0}' and ex.Category='QuWai') as aa", BranchID);
        //            where = "";
        //            orderBy = "OrderNo";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取组织信息
        //        public static DataSet GetBranchInfo(string branchName)
        //        {
        //            string sql = string.Format(@"select * from tblPartyOrgBranch where BranchName = '{0}' or BranchID = '{0}' ", branchName);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取积分编码类型
        //        public static DataSet GetScoreCode(string code)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = "select * from tblMSScoreCode where code=@code";
        //                cmd.Parameters.Add("@code", SqlDbType.VarChar).Value = code;

        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 获取微信积分单项详细信息
        //        public static DataSet GetScoreList(int page_no, int page_count, string LoginID, string ScoreCategory)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = "ScoreDate,Score,Description";
        //            table = "tblPartyObjectScore";
        //            where = string.Format(" ObjectID='{0}' and Category='{1}'", LoginID, ScoreCategory);
        //            orderBy = "ScoreDate desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }

        //        public static DataSet GetsingleScore(string LoginID, string ScoreCategory = "")
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append("select sum(Score) as sum from tblPartyObjectScore where ObjectID=@ObjectID");
        //                cmd.Parameters.Add("@ObjectID", SqlDbType.NVarChar).Value = LoginID;
        //                if (!string.IsNullOrEmpty(ScoreCategory))
        //                {
        //                    sbsql.Append(" and (Category='PartyWXBD' or Category='PartyWXGZ')");
        //                    cmd.Parameters.Add("@Category", SqlDbType.NVarChar).Value = ScoreCategory;
        //                }

        //                cmd.CommandText = sbsql.ToString();

        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 获取未配对求助信息
        //        public static DataTable QueryTakeInfo(string id)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"select Data.*,
        //ST.ParaMemberName as TitularName,STC.ParaMemberName as ThingTypeName,
        //(CASE data.IsEndTime WHEN 1 THEN '是' ELSE '否' END) as IsEndTimeName,
        //(CASE data.Purposes WHEN 2 THEN Data.PurposesDescription ELSE SP.ParaMemberName END) as PurposesName,
        //SSM.ParaMemberName as SaveModusName,
        //OM.UserName as CreateByName,OB.BranchName as CreateByBranchName,
        //(CASE data.IsSub WHEN 1 THEN '是' ELSE '否' END) as IsSubName,
        //SS.ParaMemberName as StatusName 
        //FROM tblPartyATMTakeThings Data
        //left join tblPartyOrgMembers OM on OM.LoginID = Data.CreateBy
        //left join tblPartyOrgBranch OB on OB.BranchID = Data.BranchID and OB.BranchID =OM.BranchID
        //left join tblSysSystemParameter ST on ST.ParaMember = Data.Titular and ST.ParaType = 'SXT.ATM.Titular'
        //left join tblSysSystemParameter STC on STC.ParaMember = Data.ThingType and STC.ParaType = 'SXT.ATM.ThingType'
        //left join tblSysSystemParameter SP on SP.ParaMember = Data.Purposes and SP.ParaType = 'SXT.ATM.Purposes'
        //left join tblSysSystemParameter SSM on SSM.ParaMember = Data.TakeModus and SSM.ParaType = 'SXT.ATM.SaveModus'
        //left join tblSysSystemParameter SS on SS.ParaMember = Data.Status and SS.ParaType = 'SXT.ATM.TakeStatus'
        //                                    WHERE data.ID = @ID;";
        //                cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value = id;
        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd).Tables[0];
        //            }
        //        }
        //        #endregion
        //        #region 获取未配对捐助信息
        //        public static DataTable QuerySaveInfo(string id)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"SELECT Data.*,
        //ST.ParaMemberName as TitularName,STC.ParaMemberName as ThingTypeName,
        //(CASE data.IsEndTime WHEN 1 THEN '是' ELSE '否' END) as IsEndTimeName,
        //(CASE data.Purposes WHEN 2 THEN Data.PurposesDescription ELSE SP.ParaMemberName END) as PurposesName,
        //SSM.ParaMemberName as SaveModusName,
        //OM.UserName as CreateByName,OB.BranchName as CreateByBranchName,
        //(CASE data.IsSub WHEN 1 THEN '是' ELSE '否' END) as IsSubName,
        //SS.ParaMemberName as StatusName 
        //FROM tblPartyATMSaveThings Data
        //left join tblPartyOrgMembers OM on OM.LoginID = Data.CreateBy
        //left join tblPartyOrgBranch OB on OB.BranchID = Data.BranchID and OB.BranchID =OM.BranchID
        //left join tblSysSystemParameter ST on ST.ParaMember = Data.Titular and ST.ParaType = 'SXT.ATM.Titular'
        //left join tblSysSystemParameter STC on STC.ParaMember = Data.ThingType and STC.ParaType = 'SXT.ATM.ThingType'
        //left join tblSysSystemParameter SP on SP.ParaMember = Data.Purposes and SP.ParaType = 'SXT.ATM.Purposes'
        //left join tblSysSystemParameter SSM on SSM.ParaMember = Data.SaveModus and SSM.ParaType = 'SXT.ATM.SaveModus'
        //left join tblSysSystemParameter SS on SS.ParaMember = Data.Status and SS.ParaType = 'SXT.ATM.SaveStatus'
        //                                    WHERE data.ID = @ID;";
        //                cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value = id;
        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd).Tables[0];
        //            }
        //        }
        //        #endregion
        //        #endregion

        //        #region 广氮接口
        //        #region 获取人员信息
        //        public static bool GDValidate(string systemID)
        //        {
        //            if (systemID != "9C717F5509C543C78A3B815CFAA4E066")
        //                return false;
        //            else
        //                return true;
        //        }

        //        public static DataSet GetGDMembersInfo(string branchID)
        //        {
        //            string sql = string.Format(@"select a.UserName, (Case a.Gender when '2' then '女' else '男' end) as Gender,
        //'' as Age, a.Nation,a.IdentityCard, b.BranchName,a.MobileNo,a.Address,a.Educational,
        //a.NativePlace, c.Score, c.OrderNo,(Case a.isVolunteer when '1' then '是' else '否' end) as isVolunteer
        //,(Case a.isHardParty when '1' then '是' else '否' end) as isHardParty
        //,year(getdate())-year(Birthday) as Birthday  from tblPartyOrgMembers a
        //left join tblpartyorgbranch b on a.BranchID=b.BranchID
        //left join tblPartyObjectScoreRankMember c on c.LoginID=a.LoginID and c.OrderType='all' 
        //where a.BranchID in( 
        //select id from f_BranchID('{0}')) ", branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取组织信息
        //        public static DataSet GetGDBranchInfo(string branchID)
        //        {
        //            string sql = string.Format(@"select a.BranchName,b.BranchName as ParentBranchName,c.Score, c.OrderNo from tblpartyorgbranch a
        //left join tblpartyorgbranch b on a.ParentBranchID = b.BranchID
        //left join tblPartyObjectScoreRankBranch c on a.BranchID=c.branchid and c.OrderType='all' 
        //where a.BranchID in( 
        //select id from f_BranchID('{0}')) ", branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取支部活动
        //        public static DataSet GetGDBranchActivitie(string branchID)
        //        {
        //            string sql = string.Format(@"select Title,b.BranchName,a.ActivitieTime,a.Record  from tblPartyBranchActivitie a 
        //inner join tblPartyOrgBranch b on a.CreateBy=b.BranchID
        //inner join f_BranchID('{0}') c on c.id=a.CreateBy
        // where a.Record is not null order by  a.ActivitieTime desc ", branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取志愿活动召集
        //        public static DataSet GetGDVSActivity(string branchID)
        //        {
        //            string sql = string.Format(@"select a.Title,b.BranchName,a.ActivityTime, a.ActivityAddress, a.Content, '' as JoinMembers,a.ActivityID
        //from tblPartyVSActivity a
        //inner join f_BranchID('{0}') c on c.id=a.BranchID
        //left join tblPartyOrgBranch b on a.BranchID=b.BranchID order by  a.ActivityTime desc ", branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }

        //        public static DataSet GetGDVSActivityMember(string ActivityID)
        //        {
        //            string sql = string.Format(@"select distinct usr.UserName as UserName from tblPartyVSActivityMembers Data
        //inner JOIN tblPartyOrgMembers usr ON usr.LoginID = data.LoginID
        //where 1 = 1 and ActivityID = '{0}'  ", ActivityID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取书记讲话
        //        public static DataSet GetGDLeaderSpeak()
        //        {
        //            string sql = string.Format(@"select a.Title, '' as TowTitle, a.CreateTime, a.CreateTime as publishTime,
        //c.BranchName as source, b.SecretaryName,a.Content
        //from tblPartySecretaryTalking a
        //left join tblPartySecretary b on a.SecretaryID=b.SecretaryID
        //left join tblPartyOrgBranch c on a.BranchID=c.BranchID order by a.CreateTime desc ");

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 党代表直通车——党代表信息
        //        public static DataSet GetGDPartyDeputy(string branchID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sql = string.Format(@"with temp as(
        //select data.Gender,data.UserName,data.LoginID,data.BranchID,@BranchID as DeputyBranchID,data.Post,data.ImageUrl,DeputyTypeName='本单位代表',DeputyType='1',
        //'' as ExternalID,pon.OrderNo ,Case when pon.OrderNo is null then '0' else '1' end as HasOrder from tblPartyOrgMembers data
        //left join tblPartyOrderNo pon on (pon.ObjectID=data.LoginID and pon.Category='党代表直通车' and pon.CategoryGroupby=@BranchID)
        //where 1 = 1 and isPartyDeputy='1' and runSate='0' and BranchID in (select id from f_BranchID(@BranchID)) 	
        //union 
        //select data.Gender,data.username,ex.LoginID,ex.BranchID,@BranchID as DeputyBranchID,data.Post,data.ImageUrl,DeputyTypeName='本单位代表',DeputyType='1',
        //ex.ExternalID,pon.OrderNo ,Case when pon.OrderNo is null then '0' else '1' end as HasOrder from tblPartyDeputyExternal ex
        //left join dbo.tblPartyOrgMembers data on (ex.LoginID=data.LoginID)
        //left join tblPartyOrderNo pon on (pon.ObjectID=ex.LoginID and pon.Category='党代表直通车' and pon.CategoryGroupby=@BranchID)
        //where data.runSate='0' and ex.BranchID= @BranchID and ex.Category<>'QuWai'
        //union
        // select me.Gender,ex.name as username, ex.LoginID,ex.BranchID,@BranchID as DeputyBranchID, ex.Post,me.ImageUrl as ImageUrl ,DeputyTypeName='外单位代表',
        //DeputyType='0',ex.ExternalID,pon.OrderNo ,Case when pon.OrderNo is null then '0' else '1' end as HasOrder  from tblPartyDeputyExternal ex
        //left join dbo.tblPartyOrgMembers me on (ex.LoginID=me.LoginID)
        //left join tblPartyOrderNo pon on (pon.ObjectID=ex.ExternalID and pon.Category='党代表直通车' and pon.CategoryGroupby=@BranchID)
        //where ex.BranchID= @BranchID and ex.Category='QuWai'
        //)
        //select UserName, (Case Gender when '2' then '女' else '男' end) as Gender, isnull(Post,'') as Post,isnull(ImageUrl,'') as ImageUrl,
        //(select BranchName from dbo.tblPartyOrgBranch where BranchID=@BranchID ) as DeputyBranch from temp 
        //order by HasOrder desc,OrderNo,UserName ,temp.DeputyType desc  ");

        //                cmd.Parameters.Add(new SqlParameter("@BranchID", SqlDbType.NVarChar)).Value = branchID;
        //                cmd.CommandText = sql;
        //                return DBManager.DefaultDB.ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 党代表直通车——活动公告
        //        public static DataSet GetGDDeputyMeetNotices(string branchID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sql = string.Format(@"select Data.Title,b.BranchName,Data.PartyDeputyName,data.MeetTime,data.Address,data.MeetContent 
        //from tblXHPartyMeetingInfo Data
        //left join dbo.tblPartyOrgBranch b on b.BranchID=Data.BranchID
        //where Data.BranchID = @BranchID and IsShow = '1' 
        //order by  data.MeetTime ");

        //                cmd.Parameters.Add(new SqlParameter("@BranchID", SqlDbType.NVarChar)).Value = branchID;
        //                cmd.CommandText = sql;
        //                return DBManager.DefaultDB.ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 党代表直通车——预约党代表
        //        public static DataSet GetGDMeetingWithData(string branchID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sql = string.Format(@"select SerialNumber,CreateTime,UserName,MobileNo,WorkUnit,Post,PartyDeputyName,Content 
        //from tblXHPartyMeetingWith where BranchID = @BranchID order by CreateTime desc ");

        //                cmd.Parameters.Add(new SqlParameter("@BranchID", SqlDbType.NVarChar)).Value = branchID;
        //                cmd.CommandText = sql;
        //                return DBManager.DefaultDB.ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 党代表直通车——心声传递
        //        public static DataSet GetGDPartySuggestion(string branchID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sql = string.Format(@"select a.Title,a.UserName,a.CreateTime,a.MobileNo, a.PartyDeputyName,a.Content,
        //me.UserName as RUserName, a.ModifyTime as ReplyTime,a.Reply
        //from tblXHPartySuggestion a   
        //left join tblPartyOrgMembers me on(me.LoginID= a.ModifyBy)
        // where a.BranchID = @BranchID 
        //order by a.CreateTime desc");

        //                cmd.Parameters.Add(new SqlParameter("@BranchID", SqlDbType.NVarChar)).Value = branchID;
        //                cmd.CommandText = sql;
        //                return DBManager.DefaultDB.ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 获取支援品牌
        //        public static DataSet GetGDVSBrandManage(string branchID)
        //        {
        //            string sql = string.Format(@"select a.id, a.title,a.fileid as imageUrl,a.Participants, b.BranchName,
        //usr.UserName,a.Content  
        //from tblPartyVSBrandManage a 
        //inner join f_BranchID('{0}') c on c.id=a.BranchID
        //left join tblPartyOrgBranch b on a.BranchID=b.BranchID 
        //LEFT JOIN tblPartyOrgMembers usr ON usr.LoginID = a.CreateBy
        //where a.IsPassAudit = 1 ORDER BY  a.IsFirst desc,a.CreateTime DESC ", branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取志愿者心语
        //        public static DataSet GetGDPartyVSTruth(string branchID)
        //        {
        //            string sql = string.Format(@"select a.ID, usr.UserName, a.Title from tblPartyVSTruth a 
        //inner join f_BranchID('{0}') c on c.id=a.BranchID
        //LEFT JOIN tblPartyOrgMembers usr ON usr.LoginID = a.CreateBy
        //where  a.RelationID is null or  a.RelationID =''
        //ORDER BY a.IsFirst desc,a.CreateTime DESC ", branchID);

        //            return DBManager.DefaultDB.ExecuteDataSet(sql);
        //        }
        //        #endregion
        //        #endregion

        //        #region 分类待定
        #region 获取最新的通知公告、热点新闻、学习十八大、党员先锋四个类别的资讯
        /// <summary>
        /// 获取最新的1：通知公告3：学习十八大  4：党员先锋 5:组织风采 6:干部工作 7 人才天地
        /// </summary> 
        /// <returns></returns>
        public static DataSet GetLastInformationList()
        {
            //select top 1 a.Title as title, a.CreateTime as publish_time, '2' as [type]
            //from dbo.tblPartyBranchActivitie a left join tblPartyOrgBranch b on a.CreateBy=b.BranchID
            //where a.CreateBy='D658070EC3BF425BA8417745FDCBFCB0' and 
            //(isnull(a.RelationID,'') = '' or isnull(a.IsPassAudit,'0') = 1)
            //AND a.IsSubmit = 1 and a.Status='1' and a.HomePageImage is not null and a.HomePageImage<>''
            //order by a.CreateTime DESC;
            //1：通知公告，2：热点新闻，3：学习十八大， 4：党员先锋
            //1：通知公告  2：热点新闻  3：学习十八大   4：党员先锋 5:组织风采 6:干部工作 7 人才天地
            string sql = @"select Data.Title AS title, Data.CreateTime as publish_time, '1' as type
        from tblpartyarticle Data  
        where Data.module = 'Announcement' AND Data.Status=4
        order by Data.CreateTime DESC limit 0,1; 

        select Data.Title AS title, Data.CreateTime as publish_time,'4' as type
        from tblpartyarticle DATA 
        where Data.module = 'ZHDJ.Edu.Honour' AND Data.Status=4 
        order by Data.CreateTime DESC limit 0,1; 

        select Data.Title AS title, Data.CreateTime as publish_time, '6' as type
        from tblpartyarticle DATA
        where Data.module = 'Cadre' and Data.Category in('Caution', 'SELECT', 'DYNAMIC') AND Data.Status=4  
        order by Data.CreateTime DESC limit 0,1; 

       select Data.Title AS title, Data.CreateTime as publish_time, '7' as type
        from tblpartyarticle DATA
        where Data.module = 'TalentWorld' and Data.Category in('Announcement', 'Activity', 'Policy', 'Choose') AND Data.Status=4 
        order by Data.CreateTime DESC limit 0,1; 
        ";

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql); 
        }
        #endregion

        #region 获取通知公告、热点新闻、学习十八大、党员先锋四个类别的资讯
        /// <summary>
        /// 获取通知公告、热点新闻、学习十八大、党员先锋四个类别的资讯
        /// </summary>
        /// <param name="type">1：通知公告 2：热点新闻 3：学习十八大  4：党员先锋 5:组织风采 6:干部工作 7 人才天地</param>
        /// <param name="page_no">当前页</param>
        /// <param name="page_count">每页记录条数</param>
        /// <returns></returns>
        public static DataSet GetInformationList(string type, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;
            string url = string.Empty;

            switch (type)
            {
                case "1":
                    field = string.Format(@"'' AS category, Data.flags AS isfirst, '' AS image_url, Data.ID AS msg_id, Data.Title AS title, Data.CreateTime AS publish_time,
                                                Data.CreateTime AS push_time, oUser.userName AS source");
                    table = "tblpartyarticle DATA LEFT JOIN tblpartyorgmember oUser ON oUser.LoginID = Data.CreateBy";
                    where = "Data.module = 'Announcement' AND Data.Status=4  ";
                    orderBy = "Data.flags desc, Data.CreateTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count); 
                case "4": 
                    field = string.Format(@"'' AS category, Data.flags AS isfirst, DATA.ImageID AS image_url, Data.ID AS msg_id, Data.Title AS title, Data.CreateTime AS publish_time,
                                                Data.CreateTime AS push_time, oUser.userName AS source");
                    table = "tblpartyarticle DATA LEFT JOIN tblpartyorgmember oUser ON oUser.LoginID = Data.CreateBy";
                    where = "Data.module = 'ZHDJ.Edu.Honour' AND Data.Status=4  ";
                    orderBy = "Data.flags desc, Data.CreateTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "6":  
                    field = string.Format(@"(case DATA.category when 'Caution' then '警示教育' when 'SELECT' then '干部选拔任用' else '活动动态' end) as category, Data.flags AS isfirst, DATA.ImageID AS image_url, Data.ID AS msg_id, Data.Title AS title, Data.CreateTime AS publish_time,
                                                Data.CreateTime AS push_time, oUser.userName AS source");
                    table = "tblpartyarticle DATA LEFT JOIN tblpartyorgmember oUser ON oUser.LoginID = Data.CreateBy";
                    where = "Data.module = 'Cadre' and Data.Category in('Caution', 'SELECT', 'DYNAMIC') AND Data.Status=4  ";
                    orderBy = "Data.flags desc, Data.CreateTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "7": 
                    field = string.Format(@"(case DATA.category when 'Announcement' then '最新公告' when 'Activity' then '人才活动'  when 'Policy' then '扶持政策'
                                                else '评选申报' end) as category, Data.flags AS isfirst, DATA.ImageID AS image_url, Data.ID AS msg_id, Data.Title AS title, Data.CreateTime AS publish_time,
                                                Data.CreateTime AS push_time, oUser.userName AS source");
                    table = "tblpartyarticle DATA LEFT JOIN tblpartyorgmember oUser ON oUser.LoginID = Data.CreateBy";
                    where = "Data.module = 'TalentWorld' and Data.Category in('Announcement', 'Activity', 'Policy', 'Choose') AND Data.Status=4  ";
                    orderBy = "Data.flags desc, Data.CreateTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                default:
                    return new DataSet();
            }
        }
        #endregion

        //        #region 获取热点新闻最新的5条资讯
        //        /// <summary>
        //        /// 获取热点新闻最新的
        //        /// </summary> 
        //        /// <returns></returns>
        //        public static DataSet GetLastNewsList()
        //        {
        //            /** string sql = @"with tem as (
        // select top 2 tre.ID as msg_id,tre.Title,tre.ImageID as image_url,'12' as infoType 
        // from tblPartyWorkTrends tre where tre.BranchID='D658070EC3BF425BA8417745FDCBFCB0' 
        // and tre.isTop=1 and tre.Status=1 and tre.ImageID<>''  order by tre.ModifyTime desc
        // union
        // select top 5 a.ID as msg_id,a.Title,a.HomePageImage as image_url,'2' as  infoType   from tblPartyBranchActivitie a
        // where a.CreateBy='D658070EC3BF425BA8417745FDCBFCB0' and 
        // (isnull(a.RelationID,'') = '' or isnull(a.IsPassAudit,'0') = 1)
        // AND a.IsSubmit = 1 and a.Status='1' and a.HomePageImage is not null and a.HomePageImage<>''
        // order by a.isTop desc ,a.IsFirst desc,a.ActivitieTime DESC
        // )
        // select top 5 * from tem";**/
        //            string sql = @"with tem as (
        //select top 5 tre.ID as msg_id,tre.Title,tre.ImageID as image_url,'12' as infoType 
        //from tblPartyWorkTrends tre 
        //where tre.BranchID='D658070EC3BF425BA8417745FDCBFCB0' and tre.Status=1 and tre.ImageID<>''  order by tre.isTop desc,tre.IsFirst desc, tre.ActivityTime DESC
        //union
        //select top 5 a.ID as msg_id,a.Title,a.HomePageImage as image_url,'2' as  infoType   from tblPartyBranchActivitie a
        //where a.CreateBy='D658070EC3BF425BA8417745FDCBFCB0' and 
        //(isnull(a.RelationID,'') = '' or isnull(a.IsPassAudit,'0') = 1)
        //AND a.IsSubmit = 1 and a.Status=1 and a.HomePageImage is not null and a.HomePageImage<>'' 
        //order by a.isTop desc ,a.IsFirst desc,a.ActivitieTime DESC
        //)
        //select top 5 * from tem";

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }


        ///// <summary>
        ///// 查询组织动态
        ///// </summary>
        ///// <param name="branchID"></param>
        ///// <returns></returns>
        //public static DataTable QueryNews(string branchID, int pageIndex, int pageSize, string filter = "", string orderby = "")
        //{

        //    int firstNum = pageSize * (pageIndex - 1) + 1;
        //    int endNum = pageSize * pageIndex;
        //    using (SqlCommand cmd = new SqlCommand())
        //    {
        //        StringBuilder sb = new StringBuilder();
        //        sb.Append(@"with tem as (select ba.HomePageImage as  HomePageImage,ba.ActivitieTime as ActivityTime,
        //isnull(ba.isTop,'0') as isTop ,case when ISNULL(HomePageImage,'')='' then 0 else 1 end as orderImage ,
        //isnull(SuperTop,'0') as maxtop ,'支部活动' as category,isnull(ba.IsFirst,'0') as IsFirst,
        //ba.ID as msg_id ,ba.Title, ba.CreateTime as publish_time,ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivitieTime as activity_time
        //,ba.ActivitieAddr as activity_addr,ba.Content as activity_content,'' as activity_actor, '' as activity_note_url,'2' as infoType
        //from  tblPartyBranchActivitie ba left join tblPartyOrgBranch branch on ba.CreateBy = branch.BranchID 
        //where ba.isTop=1  and  ( ba.IsPassAudit=1 or isnull(ba.RelationID,'')='')  and ba.Status=1 and ba.ShowInHomePage=1 and ba.CreateBy=@BranchID 

        //union 
        //select ba.ImageID as  HomePageImage,ba.ActivityTime,isnull(ba.isTop,'0') as isTop,
        //case when ISNULL(ba.ImageID,'')='' then 0 else 1 end as orderImage,isnull(SuperTop,'0')  as maxtop    ,
        //'工作动态' as category,isnull(ba.IsFirst,'0') as IsFirst ,
        //ba.ID as msg_id  ,ba.Title,ba.CreateTime as publish_time, ba.CreateTime as push_time,
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time,
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'12' as infoType
        //from tblPartyWorkTrends ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID 
        //where ba.isTop=1 and ba.Status=1 and ba.BranchID=@BranchID 
        //union
        //select ba.HomePageImage as  HomePageImage ,ba.ActivitieTime as ActivityTime,isnull(ba.isTop,'0') as isTop ,
        //case when ISNULL(HomePageImage,'')='' then 0 else 1 end as orderImage,
        //isnull(SuperTop,'0')  as maxtop ,'支部活动' as category,
        //isnull(ba.IsFirst,'0') as IsFirst,
        //ba.ID as msg_id,ba.Title,ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivitieTime as activity_time, 
        //ba.ActivitieAddr as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'2' as infoType
        //from  tblPartyBranchActivitie ba left join tblPartyOrgBranch branch on  ba.CreateBy = branch.BranchID  
        //where isnull(ba.isTop,'0')<>1  and  ( ba.IsPassAudit=1 or isnull(ba.RelationID,'')='') and ba.Status=1  and ba.ShowInHomePage=1 
        //and ba.CreateBy=@BranchID 
        //union 

        //select ba.ImageID as  HomePageImage,ba.ActivityTime,isnull(ba.isTop,'0') as isTop,
        //case when ISNULL(ba.ImageID,'')='' then 0 else 1 end as orderImage ,
        //isnull(SuperTop,'0')  as maxtop  ,'工作动态' as category,isnull(ba.IsFirst,'0') as IsFirst ,
        //ba.ID as msg_id ,ba.Title,ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'12' as infoType
        //from tblPartyWorkTrends ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID  
        //where isnull(ba.isTop,'0')<>1   and ba.Status=1 and ba.BranchID=@BranchID
        //union  

        //select '' as  HomePageImage,ba.ActivityTime,
        //'0' as isTop,'0' as orderImage,'0' as maxtop ,'品牌活动' as category,
        //isnull(ba.IsFirst,'0') as IsFirst  ,ba.ID as msg_id,ba.title
        //, ba.CreateTime as publish_time, ba.CreateTime as push_time,
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'8' as infoType
        //from tblPartyOneBranchOneBrand ba  left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID 
        // where  ( ba.IsAudit=1 or isnull(ba.RelationID,'')='') and ba.IsDone=1 and ba.ShowInHomePage=1 and ba.BranchID=@BranchID
        //union 
        //select '' as  HomePageImage,ba.ActivityTime,'0' as isTop,'0' as orderImage ,'0' as maxtop  
        //,'党内关爱' as category,isnull(ba.IsFirst,'0') as IsFirst  ,ba.ID as msg_id,Title
        //,ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'9' as infoType
        //from tblPCCareInfoCourier ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID 
        //where  ( ba.IsPassAudit=1 or isnull(ba.RelationID,'')='')  and ba.Status=1  
        //and ba.ShowInHomePage=1 and ba.BranchID=@BranchID 
        //union    
        //select '' as  HomePageImage,ba.ActivityTime,'0' as isTop,'0' as orderImage ,'0' as maxtop  ,
        //'志愿服务' as category,
        //isnull(ba.IsFirst,'0') as IsFirst ,ba.activityid as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'11' as infoType
        //from tblPartyVSActivity ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID
        //where (ba.IsPassAudit=1 or isnull(ba.RelationID,'')='') and ba.Status=1  and ba.ShowInHomePage=1 and ba.BranchID=@BranchID )");

        //        sb.AppendFormat(@" SELECT T.* FROM (
        //                                select ROW_NUMBER() OVER(ORDER BY maxtop desc {2} ,ActivityTime DESC,msg_id ) AS RowNum, tem.* from tem ) 
        //                                AS T
        //                                WHERE RowNum BETWEEN {0} AND {1} ", firstNum, endNum, string.IsNullOrEmpty(orderby) ? "" : "," + orderby);
        //        if (!string.IsNullOrEmpty(filter))
        //        {
        //            sb.Append(" and " + filter);
        //        }
        //        cmd.Parameters.Add("@BranchID", SqlDbType.VarChar).Value = branchID;
        //        cmd.CommandText = sb.ToString();

        //        return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd).Tables[0];
        //    }
        //}

        //        public static DataTable QueryNewsEx(string branchID, int pageIndex, int pageSize)
        //        {

        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sb = new StringBuilder();
        //                sb.Append(@"with tem as (select '2' as infoType,ba.ID ,'<font color=red>[活动]</font> '+ba.Title as Title1,ba.Title,ba.ActivitieTime as ActivityTime,'BranchActivitie' as Category,ba.isTop as isTop ,ba.IsFirst as IsFirst,ba.HomePageImage as  HomePageImage ,case when ISNULL(HomePageImage,'')='' then 0 else 1 end as orderImage ,'1' as maxtop 
        //from  tblPartyBranchActivitie ba where isTop=1  and  ( ba.IsPassAudit=1 or isnull(RelationID,'')='')  and Status=1 and ba.CreateBy=@BranchID 
        //union 
        //select '12' as infoType,tre.ID  ,'<font color=red>[动态]</font> '+tre.Title as Title1,Title,tre.ActivityTime,'WorkTrends' as Category,tre.isTop as isTop,tre.IsFirst as IsFirst ,tre.ImageID as  HomePageImage,case when ISNULL(tre.ImageID,'')='' then 0 else 1 end as orderImage,(case SuperTop when '1' then '2' else '1' end) as maxtop    
        //from tblPartyWorkTrends tre where isTop=1 and tre.Status=1 and tre.BranchID=@BranchID 
        //union
        //select '2' as infoType,ba.ID ,'<font color=red>[活动]</font> '+ba.Title as Title1,ba.Title,ba.ActivitieTime as ActivityTime,'BranchActivitie' as Category,ba.isTop as isTop ,ba.IsFirst as IsFirst,ba.HomePageImage as  HomePageImage ,case when ISNULL(HomePageImage,'')='' then 0 else 1 end as orderImage,'0' as maxtop   
        //from  tblPartyBranchActivitie ba where isnull(isTop,'0')<>1  and  ( ba.IsPassAudit=1 or isnull(RelationID,'')='') and Status=1 and ba.CreateBy=@BranchID 
        //union  
        //select '8' as infoType,brand.ID ,'<font color=red>[品牌]</font> '+brand.Title  as Title1,Title,brand.ActivityTime,'OneBrand' as Category,'0' as isTop,brand.IsFirst as IsFirst  ,'' as  HomePageImage,'0' as orderImage,'0' as maxtop  
        //from tblPartyOneBranchOneBrand brand   where ( brand.IsAudit=1 or isnull(RelationID,'')='') and IsDone=1 and brand.BranchID=@BranchID
        //union 
        //select '9' as infoType,Care.ID ,'<font color=red>[关爱]</font> '+Care.Title as Title1,Title,Care.ActivityTime,'CareInfo' as Category,'0' as isTop,Care.IsFirst as IsFirst  ,'' as  HomePageImage,'0' as orderImage ,'0' as maxtop   
        //from tblPCCareInfoCourier Care where ( Care.IsPassAudit=1 or isnull(RelationID,'')='')  and Status=1 and Care.BranchID=@BranchID 
        //union  
        //select '10' as infoType,VSI.ID ,'<font color=red>[志愿]</font> '+VSI.Title as Title1,Title,VSI.ActivityTime,'VSInfo' as Category,'0' as isTop,VSI.IsFirst as IsFirst ,'' as  HomePageImage,'0' as orderImage ,'0' as maxtop    
        //from tblPartyVSInfoExpress VSI where (VSI.IsPassAudit=1 or isnull(RelationID,'')='') and Status=1 and VSI.BranchID=@BranchID
        //union  
        //select '11' as infoType,VSA.ActivityID as ID ,'<font color=red>[志愿]</font> '+VSA.Title as Title1,Title,VSA.ActivityTime,'VSActivity' as Category,'0' as isTop,VSA.IsFirst as IsFirst ,'' as  HomePageImage,'0' as orderImage ,'0' as maxtop   
        //from tblPartyVSActivity VSA where (VSA.IsPassAudit=1 or isnull(RelationID,'')='') and Status=1 and VSA.BranchID=@BranchID
        //union 
        //select '12' as infoType,tre.ID  ,'<font color=red>[动态]</font> '+tre.Title as Title1,Title,tre.ActivityTime,'WorkTrends' as Category,tre.isTop as isTop,tre.IsFirst as IsFirst ,tre.ImageID as  HomePageImage,case when ISNULL(tre.ImageID,'')='' then 0 else 1 end as orderImage ,'0' as maxtop    
        //from tblPartyWorkTrends tre where isnull(isTop,'0')<>1   and tre.Status=1 and tre.BranchID=@BranchID     
        //)");
        //                sb.AppendFormat(@" SELECT T.* FROM (
        //                                select ROW_NUMBER() OVER(ORDER BY maxtop desc,ActivityTime DESC) AS RowNum, tem.* from tem ) 
        //                                AS T
        //                                WHERE RowNum BETWEEN {0} AND {1} ", pageIndex * pageSize + 1, (pageIndex + 1) * pageSize);
        //                cmd.Parameters.Add("@BranchID", SqlDbType.VarChar).Value = branchID;
        //                cmd.CommandText = sb.ToString();
        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd).Tables[0];
        //            }
        //        }

        //        public static string GetCount(string branchID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sb = new StringBuilder();
        //                sb.Append("with tem as ( ");

        //                //支部活动
        //                sb.Append(" select ba.ID ,'<font color=red>[活动]</font> '+ba.Title as Title,ba.ActivitieTime as ActivityTime,'BranchActivitie' as Category,ba.isTop as isTop ,ba.IsFirst as IsFirst,ba.HomePageImage as  HomePageImage ,case when ISNULL(HomePageImage,'')='' then 0 else 1 end as orderImage  from  tblPartyBranchActivitie ba where ba.IsPassAudit=1 and Status=1 and ba.CreateBy=@BranchID ");
        //                sb.Append(" union  ");
        //                //一支部一品牌
        //                sb.Append(" select brand.ID ,'<font color=red>[品牌]</font> '+brand.Title  as Title,brand.ActivityTime,'OneBrand' as Category,'0' as isTop,brand.IsFirst as IsFirst  ,'' as  HomePageImage,'0' as orderImage  from tblPartyOneBranchOneBrand brand where brand.IsAudit=1 and IsDone=1 and brand.BranchID=@BranchID ");
        //                sb.Append(" union ");
        //                //关爱信息速递 
        //                sb.Append(" select Care.ID ,'<font color=red>[关爱]</font> '+Care.Title as Title,Care.ActivityTime,'CareInfo' as Category,'0' as isTop,Care.IsFirst as IsFirst  ,'' as  HomePageImage,'0' as orderImage  from tblPCCareInfoCourier Care where Care.IsPassAudit=1 and Status=1 and Care.BranchID=@BranchID ");
        //                sb.Append(" union  ");
        //                //志愿信息 
        //                sb.Append(" select VSI.ID ,'<font color=red>[志愿]</font> '+VSI.Title as Title,VSI.ActivityTime,'VSInfo' as Category,'0' as isTop,VSI.IsFirst as IsFirst ,'' as  HomePageImage,'0' as orderImage   from tblPartyVSInfoExpress VSI where VSI.IsPassAudit=1 and Status=1 and VSI.BranchID=@BranchID ");
        //                sb.Append(" union  ");
        //                //志愿活动
        //                sb.Append(" select VSA.ActivityID as ID ,'<font color=red>[志愿]</font> '+VSA.Title as Title,VSA.ActivityTime,'VSActivity' as Category,'0' as isTop,VSA.IsFirst as IsFirst ,'' as  HomePageImage,'0' as orderImage  from tblPartyVSActivity VSA where VSA.IsPassAudit=1 and Status=1 and VSA.BranchID=@BranchID ");
        //                sb.Append(" union ");
        //                //
        //                sb.Append(" select tre.ID  ,'<font color=red>[动态]</font> '+tre.Title as Title,tre.ActivityTime,'WorkTrends' as Category,tre.isTop as isTop,tre.IsFirst as IsFirst ,tre.ImageID as  HomePageImage,case when ISNULL(tre.ImageID,'')='' then 0 else 1 end as orderImage   from tblPartyWorkTrends tre where tre.Status=1 and tre.BranchID=@BranchID   ");
        //                sb.Append("   ) ");
        //                sb.Append(@" select Count(1) from tem   ");
        //                cmd.Parameters.Add("@BranchID", SqlDbType.VarChar).Value = branchID;
        //                cmd.CommandText = sb.ToString();
        //                object obj = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);

        //                if (obj != null && obj.ToString() != "")
        //                    return obj.ToString();
        //                else
        //                    return "0";
        //            }
        //        }

        //        public static DataTable QueryNewsSuoYeImage(string branchID)
        //        {
        //            DataTable dt = QueryNews(branchID, 1, 50, " orderImage=1 ", "isfirst desc");
        //            DataTable dttemp = dt.Clone();
        //            if (dt != null)
        //            {
        //                foreach (DataRow dr in dt.Rows)
        //                {
        //                    //有图且为置顶
        //                    if (dr["orderImage"].ToString() == "1")
        //                    {
        //                        dttemp.Rows.Add(dr.ItemArray);
        //                        if (dttemp.Rows.Count >= 5)
        //                        {
        //                            break;
        //                        }
        //                    }

        //                }
        //            }
        //            return dttemp;
        //        }
        //        #endregion

        //        #region 组织风采列表查询接口(目前只实现支部活动查询，一支部一品牌与支部活动是完全独立的，后期再考虑合并)
        //        public static DataSet GetBranchActivityListEx(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;
        //            string url = string.Empty;

        //            field = string.Format(@"*");
        //            table = @"(select '活动' as category,ba.IsFirst,ba.ID as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivitieTime as activity_time, 
        //ba.ActivitieAddr as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'2' as infoType
        //from  tblPartyBranchActivitie ba left join tblPartyOrgBranch branch on ba.CreateBy = branch.BranchID
        //where ba.IsPassAudit=1 and Status=1 and ba.CreateBy='D658070EC3BF425BA8417745FDCBFCB0' 
        //union   
        //select '品牌' as category,ba.IsFirst,ba.ID as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'8' as infoType
        //from tblPartyOneBranchOneBrand ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID
        //where ba.IsAudit=1 and ba.IsDone=1 and ba.BranchID='D658070EC3BF425BA8417745FDCBFCB0'   
        //union  
        //select '关爱' as category,ba.IsFirst,ba.ID as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'9' as infoType
        //from tblPCCareInfoCourier ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID
        //where ba.IsPassAudit=1 and ba.Status=1 and ba.BranchID='D658070EC3BF425BA8417745FDCBFCB0'   
        //union   
        //select '志愿' as category,ba.IsFirst,ba.ID as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'10' as infoType
        //from tblPartyVSInfoExpress ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID
        //where ba.IsPassAudit=1 and ba.Status=1 and ba.BranchID='D658070EC3BF425BA8417745FDCBFCB0'   
        //union 
        //select '志愿' as category,ba.IsFirst,ba.activityid as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'11' as infoType
        //from tblPartyVSActivity ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID
        //where ba.IsPassAudit=1 and ba.Status=1 and ba.BranchID='D658070EC3BF425BA8417745FDCBFCB0' 
        //union
        //select '动态' as category,ba.IsFirst,ba.ID as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivityTime as activity_time, 
        //'' as activity_addr,ba.Content as activity_content,  '' as activity_actor, '' as activity_note_url,'12' as infoType
        //from tblPartyWorkTrends ba left join tblPartyOrgBranch branch on ba.BranchID = branch.BranchID
        //where ba.Status=1 and ba.BranchID='D658070EC3BF425BA8417745FDCBFCB0'
        //) aa";
        //            where = "";
        //            orderBy = "activity_time DESC";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }


        //        /// <summary>
        //        /// 查询活动参与者
        //        /// </summary>
        //        /// <param name="id"></param>
        //        /// <returns></returns>
        //        public static string QueryActivityMembers(string id)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbMembers = new StringBuilder();
        //                cmd.CommandText = @"SELECT b.LoginID, b.UserName from tblPartyBranchActivitie as a,tblPartyOrgMembers as b
        //                                    WHERE charindex(','+b.LoginID+',', ','+ltrim(Participant)+',') > 0 and a.id = @ID;";
        //                cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value = id;
        //                DataTable dt = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd).Tables[0];
        //                foreach (DataRow dr in dt.Rows)
        //                {
        //                    if (sbMembers.Length > 0)
        //                        sbMembers.AppendFormat(",{0}", dr["UserName"]);
        //                    else
        //                        sbMembers.Append(dr["UserName"]);
        //                }

        //                return sbMembers.ToString();
        //            }
        //        }
        //        #endregion

        //        #region 最新的资讯数量，组织风采[废弃了]

        //        /// <summary>
        //        /// 组织风采列表查询接口(目前只实现支部活动查询，一支部一品牌与支部活动是完全独立的，后期再考虑合并)
        //        /// </summary> 
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录条数</param>
        //        /// <returns></returns>
        //        public static DataSet GetBranchActivityList(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;
        //            string url = string.Empty;

        //            url = CommonUtils.AppAddressEx + "html/InformationDetail.aspx?InfoType=5&InfoID=";
        //            field = string.Format(@"ba.IsFirst,ba.ID as msg_id,ba.title, ba.CreateTime as publish_time, ba.CreateTime as push_time, 
        //ba.CreateBy as branch_id,branch.BranchName as branch_name, ba.ActivitieTime as activity_time, 
        //ba.ActivitieAddr as activity_addr,ba.Content as activity_content,  '' as activity_actor, '{0}' + ba.ID as activity_note_url", url);
        //            table = "tblPartyBranchActivitie ba left join tblPartyOrgBranch branch on ba.CreateBy = branch.BranchID";
        //            where = "ba.CreateBy = 'D658070EC3BF425BA8417745FDCBFCB0' AND ba.IsSubmit = 1 and ba.Status=1 and isnull(ba.HomePageImage, '')='' ";
        //            orderBy = "ba.isTop desc ,ba.IsFirst desc,ba.ActivitieTime DESC ";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }

        //        /// <summary>
        //        /// 最新的资讯数量[废弃了]
        //        /// </summary> 
        //        /// <returns></returns>
        //        public static DataSet GetInformationCount()
        //        {
        //            string sql = @"select count(*) from tblPortalPublicNotice where Category = '0' and IsShowPortal = 1; 

        //select count(*) from dbo.tblPartyBranchActivitie a where a.CreateBy='D658070EC3BF425BA8417745FDCBFCB0' and 
        //(isnull(a.RelationID,'') = '' or isnull(a.IsPassAudit,'0') = 1)
        //AND a.IsSubmit = 1 and a.Status='1' and a.HomePageImage is not null and a.HomePageImage<>'';

        //select count(*) from tblPartyLearn18 a where ShowInHomePage = 1 AND IsAudit = 1 and a.Category in('CarryOutFulfil','MassLineTalk','StudyExchange') ;

        //select count(*) from tblPartyHonour a where a.CreateBy = 'admin';

        //SELECT COUNT(*) FROM tblPartyBranchActivitie ba WHERE ba.CreateBy = 'D658070EC3BF425BA8417745FDCBFCB0' AND ba.IsSubmit = 1 and ba.Status=1 and isnull(ba.HomePageImage, '')='';";

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        #region 资讯详情
        /// <summary>
        /// 资讯详情
        /// </summary>
        /// <param name="infoID"></param>
        /// <param name="infoType">1：通知公告，2：热点新闻，3：学习十八大， 4：党员先锋 </param>
        /// <returns></returns>
        public static DataSet GetInformationDetail(string infoID, string infoType)
        {
            string sql = "";

            if (infoType == "17" || infoType == "18")
            {
                sql = string.Format(@"SELECT Data.Title AS infoTitle, data.CreateTime AS infoTime,
                                    oUser.UserName AS UserName, Data.content FROM tblpartybranchdraft DATA
                                    LEFT JOIN tblpartyorgmember oUser ON oUser.LoginID = Data.CreateBy  
                                    where 1 = 1  and  Data.ID = '{0}'", infoID);
            }
            else
            {
                sql = string.Format(@"SELECT Data.Title as infoTitle, data.CreateTime as infoTime,
                                    oUser.UserName as UserName, Data.content from tblpartyarticle Data
                                    left join tblpartyorgmember oUser on oUser.LoginID = Data.CreateBy  
                                    where 1 = 1  and  Data.ID = '{0}'", infoID);
            }

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
        }
        #endregion

        #region 获取用户的积分详情信息
        /// <summary>
        /// 获取用户的积分详情信息
        /// </summary> 
        /// <param name="userID">用户ID</param>
        /// <param name="page_no">当前页</param>
        /// <param name="page_count">每页记录条数</param>
        /// <returns></returns>
        public static DataSet GetMemberScoreDetailList(string userID, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = "Description as detail_item, Score as score, ScoreDate as time ";
            table = "tblPartyObjectScore";
            where = "ObjectType = 'Member' and Score!=0 and ObjectID='" + userID + "'";
            orderBy = "ScoreDate DESC ";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        //        #region 获取组织的积分详情信息
        //        /// <summary>
        //        /// 获取组织的积分详情信息
        //        /// </summary> 
        //        /// <param name="userID">组织ID</param>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录条数</param>
        //        /// <returns></returns>
        //        public static DataSet GetBranchScoreDetailList(string branch_id, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = "[Description] as detail_item, Score as score, ScoreDate as [time] ";
        //            table = "tblPartyObjectScore";
        //            where = "ObjectType != 'Member' and ObjectID='" + branch_id + "'";
        //            orderBy = "ScoreDate DESC ";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        #region 获取用户的积分排名
        /// <summary>
        /// 获取用户的积分积分排名
        /// </summary> 
        /// <param name="type">类别 1：个人积分排名，2：所在支部排名</param>
        /// <param name="branchID">支部ID 如果是支部排名，则提供支部ID</param>
        /// <param name="orderType">排序方式:默认升序 1：升序，2：降序</param>
        /// <param name="page_no">当前页</param>
        /// <param name="page_count">每页记录条数</param>
        /// <returns></returns>
        public static DataSet GetMemberScoreRankList(string type, string branchID, string orderType, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            if (orderType == "2")
                orderBy = "score asc";
            else
                orderBy = "score desc";

            if (type == "1")
            {
                field = "loginid as party_id,username as party_name,score as total_int,rank as rank_num ";
                where = " 1=1 ";
            }
            else
            {
                field = "loginid as party_id,username as party_name,score as total_int,branchrank as rank_num ";
                where = " branchid='" + branchID + "' ";
            }

            table = "tblpartyscorerankmember";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        #region 获取支部的积分排名
        /// <summary>
        /// 获取支部的积分积分排名
        /// </summary>  
        /// <param name="orderType">排序方式:默认升序 1：升序，2：降序</param>
        /// <param name="page_no">当前页</param>
        /// <param name="page_count">每页记录条数</param>
        /// <returns></returns>
        public static DataSet GetBranchScoreRankList(string orderType, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = "a.BranchID AS branch_id,b.BranchName AS branch_name,a.Score  AS total_int, a.Rank AS rank_num  ";
            table = "tblpartyscorerankbranch a LEFT JOIN tblpartyorgbranch b ON a.BranchID=b.BranchID";
            where = "1=1";

            if (orderType == "2")
                orderBy = "a.Rank desc";
            else
                orderBy = "a.Rank asc";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        //        #region 获取我的待办事项数量统计
        //        /// <summary>
        //        /// 获取我的待办事项数量统计
        //        /// </summary>
        //        /// <param name="loginID">用户登录ID</param>
        //        /// <returns></returns>
        //        public static DataSet GetMyTaskCount(string loginID)
        //        {
        //            string dt = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
        //            //string brandID = InterfaceHelper.IsAbleQueryBranchTask(loginID);
        //            string sql = string.Format(@"select count(*) from tblPartyTask where TaskType=1 and ToUser='{0}' and TaskSpecie='Member' 
        //	and category in('普通党课','视频党课','掌上党课','普通会议','视频会议','掌上会议');

        //select count(*) from tblPartyTask where TaskType=1 and ToUser='{0}' and TaskSpecie='Member' 
        //	and category in('普通活动','视频活动','掌上活动','支部活动');

        //select count(*) from tblPartyVSActivity task left join tblPartyOrgMembers om on om.LoginID=task.CreateBy 
        //where task.IsPassAudit = 1 and  task.Category <> '3' and task.activitytime >= '{1}';

        //select count(*) from tblPartyTask task left join tblPartyOrgMembers om on task.FromUser=om.LoginID where task.TaskType=1 
        //and task.ToUser='{0}' and task.TaskSpecie='Member'  and  task.category in('爱心柜员机');", loginID, dt);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 我的待办事项列表
        //        /// <summary>
        //        /// 我的待办事项列表
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="keyWord">查询关键字	关键字包括标题、发起人</param>
        //        /// <param name="type">类别		1：三会一课，2：支部活动，3：志愿活动</param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetMyTaskList(string userID, string keyWord, string type, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;
        //            string dt = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";

        //            field = "task.TaskID as todo_id, task.RelationID as rel_id, task.Title as title,om.UserName as organiser, task.CreateTime as create_time";
        //            table = "tblPartyTask task left join tblPartyOrgMembers om on task.FromUser=om.LoginID";
        //            orderBy = "task.CreateTime desc";

        //            where = "task.TaskType=1 and task.ToUser='" + userID + "' and task.TaskSpecie='Member'  ";
        //            if (type == "1")
        //                where += "and task.category in('普通党课','视频党课','掌上党课','普通会议','视频会议','掌上会议')";
        //            else if (type == "2")
        //                where += "and  task.category in('普通活动','视频活动','掌上活动','支部活动')";
        //            else if (type == "3")
        //            {
        //                field = "'PartyVSActivity' as todo_id, task.ActivityID as rel_id, task.Title as title,om.UserName as organiser, task.CreateTime as create_time";
        //                table = "tblPartyVSActivity task left join tblPartyOrgMembers om on om.LoginID=task.CreateBy";
        //                where = "task.IsPassAudit = 1 and  task.Category <> '3' and task.activitytime >= '" + dt + "' ";
        //                orderBy = "task.IsFirst desc,task.CreateTime DESC";
        //            }
        //            else if (type == "4")
        //            {
        //                //where = "task.TaskType=1 and task.ToUser in(" + userID + ") ";
        //                where += "and  task.category in('爱心柜员机')";
        //            }

        //            if (!string.IsNullOrEmpty(keyWord))
        //                where += "and (task.Title like '%" + keyWord + "%' or om.UserName like '%" + keyWord + "%')";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取单条待办记录
        //        /// <summary>
        //        /// 获取单条待办记录
        //        /// </summary>
        //        /// <param name="taskID">待办ID号</param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyTaskByID(string taskID)
        //        {
        //            string sql = "select task.*, om.userName from tblPartyTask task left join tblPartyOrgMembers om on task.FromUser=om.LoginID where task.taskID = '" + taskID + "'";
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //        public static DataSet GetPartyTaskByID(string taskID, string relationID)
        //        {
        //            string sql = "";
        //            if (taskID == "PartyVSActivity")
        //            {
        //                sql = "select task.CreateTime as CreateTime, task.Title, '志愿活动' as category,task.ActivityID as RelationID, om.userName from tblPartyVSActivity task left join tblPartyOrgMembers om on task.CreateBy=om.LoginID where task.ActivityID = '" + relationID + "'";
        //            }
        //            else
        //            {
        //                sql = "select task.*, om.userName from tblPartyTask task left join tblPartyOrgMembers om on task.FromUser=om.LoginID where task.taskID = '" + taskID + "'";
        //            }
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取待办详情
        //        public static DataSet GetPartyTaskDetail(string type, string relationID, string loginID)
        //        {
        //            string sql = "";
        //            if (type == "1")
        //                sql = "select '' as act_status, '1' as [type], coursestime as meeting_time, coursesaddr as meeting_addr, CoursesContent as content, Participant as actors from tblPartyMyCourses where id = '{0}'";
        //            else if (type == "2")
        //                sql = "select '' as act_status, '2' as [type], MeetingTime as meeting_time, MeetingAddr as meeting_addr, MeetingContent as content, Participant as actors from tblPartyMyMeeting where id = '{0}'";
        //            else if (type == "3")
        //                sql = "select '' as act_status, '3' as [type], ActivitieTime as meeting_time, ActivitieAddr as meeting_addr, Content as content, Participant as actors from tblPartyBranchActivitie where id = '{0}'";
        //            else if (type == "4")
        //                sql = string.Format(@"select '4' as [type], ActivityTime as meeting_time, ActivityAddress as meeting_addr, Content as content, '' as actors,
        //(select COUNT(*) from tblPartyVSActivityMembers where ActivityID = '{0}' and LoginID='{1}') as act_status
        // from tblPartyVSActivity where ActivityID = '{0}'", relationID, loginID); //目前不知道志愿者活动对应的表 
        //            else
        //                return null;

        //            sql = string.Format(sql, relationID);
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //        public static DataSet GetPartyVSActivityMembers(string relationID)
        //        {
        //            string sql = string.Format(@"select distinct a.LoginID, om.UserName from tblPartyVSActivityMembers a
        //left join tblPartyOrgMembers om on a.LoginID=om.LoginID where a.ActivityID = '{0}'", relationID);
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //        public static DataSet GetPartyTaskDetailEx(string relationID)
        //        {
        //            string sql = string.Format(@"select OM.UserName as help_person,STC.ParaMemberName as help_type,c.Name as help_name,
        //c.ThingCount as help_count,c.EndTime as help_expiry_date,c.Description as help_content,
        //OMM.UserName as offer_person,STCS.ParaMemberName as offer_type,b.Name as offer_name,
        //b.ThingCount as offer_count, b.EndTime as offer_expiry_date,b.Description as offer_content
        //from tblPartyATMSaveAndTake a  
        //inner join tblPartyATMSaveThings b on a.SaveID=b.ID
        //inner join tblPartyATMTakeThings c on a.Takeid=c.id
        //left join tblPartyOrgMembers OM on OM.LoginID = c.CreateBy
        //left join tblSysSystemParameter STC on STC.ParaMember = c.ThingType and STC.ParaType = 'SXT.ATM.ThingType'
        //left join tblPartyOrgMembers OMM on OMM.LoginID = b.CreateBy
        //left join tblSysSystemParameter STCS on STCS.ParaMember = b.ThingType and STCS.ParaType = 'SXT.ATM.ThingType'
        //where a.ID='{0}'", relationID);
        //            sql = string.Format(sql, relationID);
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 党课签到
        //        /// <summary>
        //        /// 党课签到
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="meetingID">党课ID</param> 
        //        /// <returns></returns>
        //        public static bool CoursesSignIn(string userID, string meetingID)
        //        {
        //            string strSql = string.Format(@"if not exists(select * from tblPartyMyCoursesAttend where ID='{0}' and LoginID='{1}' and AttendType='{2}')
        //insert into tblPartyMyCoursesAttend(ID,LoginID,CreateTime,Remark,AttendType) select ID,LoginID,GETDATE(),Remark,'{2}' 
        //from tblPartyMyCoursesAttend where AttendType='报名确认' and ID = '{0}' and LoginID in ('{1}');"
        //                , meetingID, userID, "签到确认");

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(strSql) > 0;
        //        }
        //        #endregion

        //        #region 活动签到
        //        /// <summary>
        //        /// 活动签到
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="meetingID">活动ID</param> 
        //        /// <returns></returns>
        //        public static bool RanchActivitieSignIn(string userID, string meetingID)
        //        {
        //            string strSql = string.Format(@"if not exists(select * from tblPartyBranchActivitieAttend where ID='{0}' and LoginID='{1}' and AttendType='{2}')
        //insert into tblPartyBranchActivitieAttend(ID,LoginID,CreateTime,Remark,AttendType) select ID,LoginID,GETDATE(),Remark,'{2}' 
        //from tblPartyBranchActivitieAttend where AttendType='报名确认' and ID = '{0}' and LoginID in ('{1}');"
        //                , meetingID, userID, "签到确认");

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(strSql) > 0;
        //        }
        //        #endregion

        //        #region 我要报名，请假接口
        //        public static bool MaTaskJoinVSActivity(string relationID, string userID)
        //        {
        //            string sql = string.Format(@"delete from tblPartyVSActivityMembers where ActivityID='{0}' and LoginID='{1}' and Status='0';
        //                    insert into tblPartyVSActivityMembers(ActivityID,LoginID,Status, CreateTime)
        //                    values('{0}','{1}','0',GETDATE())", relationID, userID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }

        //        public static bool MaTaskJoinOrLeave(string relationID, string userID, string category, string attendType)
        //        {
        //            //string attendType = "参加确认";//请假确认

        //            if (category == "普通党课" || category == "视频党课" || category == "掌上党课")
        //            {
        //                using (SqlCommand cmd = new SqlCommand())
        //                {
        //                    StringBuilder sbSql = new StringBuilder();

        //                    sbSql.Append(string.Format(@"delete from tblPartyMyCoursesAttend where id='{0}' and AttendType='{1}' and LoginID='{2}'; ", relationID, attendType, userID));

        //                    sbSql.Append(@"insert into tblPartyMyCoursesAttend select top 1 ID,LoginID,GETDATE(),Remark,'" + attendType + @"' 
        //from tblPartyMyCoursesAttend where AttendType='报名确认' and ID = '" + relationID + "' and LoginID in ('" + userID + "');");

        //                    cmd.CommandText = sbSql.ToString();
        //                    return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //                }
        //            }
        //            else if (category == "普通会议" || category == "视频会议" || category == "掌上会议")
        //            {
        //                using (SqlCommand cmd = new SqlCommand())
        //                {
        //                    StringBuilder sbSql = new StringBuilder();
        //                    sbSql.Append(string.Format(@"delete from tblPartyMyMeetingAttend where id='{0}' and AttendType='{1}' and LoginID='{2}'; ", relationID, attendType, userID));

        //                    sbSql.Append(@"insert into tblPartyMyMeetingAttend(ID,LoginID,CreateTime,Remark,AttendType) select ID,LoginID,GETDATE(),Remark,'" + attendType + @"' 
        //from tblPartyMyMeetingAttend where AttendType='报名确认' and ID = '" + relationID + "' and LoginID in ('" + userID + "');");

        //                    cmd.CommandText = sbSql.ToString();
        //                    return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //                }
        //            }
        //            else if (category == "普通活动" || category == "视频活动" || category == "掌上活动" || category == "支部活动")
        //            {
        //                using (SqlCommand cmd = new SqlCommand())
        //                {
        //                    StringBuilder sbSql = new StringBuilder();
        //                    sbSql.Append(string.Format(@"delete from tblPartyBranchActivitieAttend where id='{0}' and AttendType='{1}' and LoginID='{2}'; ", relationID, attendType, userID));

        //                    sbSql.Append(@"insert into tblPartyBranchActivitieAttend select ID,LoginID,GETDATE(),Remark,'" + attendType + @"' 
        //from tblPartyBranchActivitieAttend where AttendType='报名确认' and ID = '" + relationID + "' and LoginID in ('" + userID + "');");

        //                    cmd.CommandText = sbSql.ToString();
        //                    return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //                }
        //            }
        //            else
        //            {
        //                if (!isParticipateActivity(relationID, userID) && attendType == "参加确认")
        //                {
        //                    using (SqlCommand cmd = new SqlCommand())
        //                    {
        //                        StringBuilder sbSql = new StringBuilder();
        //                        sbSql.Append(string.Format(@"insert into tblPartyVSActivityMembers(ActivityID, LoginID, Status, CreateTime)
        //values('{0}','{1}','0', GETDATE())", relationID, userID));

        //                        cmd.CommandText = sbSql.ToString();
        //                        return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //                    }
        //                }
        //                else
        //                {
        //                    return true;
        //                }
        //            }
        //        }

        //        /// <summary>
        //        /// 志愿者活动是否已经报名
        //        /// </summary>
        //        /// <param name="activityID"></param>
        //        /// <param name="loginID"></param>
        //        /// <returns></returns>
        //        public static bool isParticipateActivity(string activityID, string userID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.Append(" select count(*) from tblPartyVSActivityMembers Data where 1 = 1 ");

        //                if (!string.IsNullOrEmpty(activityID))
        //                {
        //                    sbSql.Append(" and Data.ActivityID = @ActivityID");
        //                    cmd.Parameters.Add("@ActivityID", SqlDbType.VarChar).Value = string.Format("{0}", activityID);
        //                }

        //                if (!string.IsNullOrEmpty(userID))
        //                {
        //                    sbSql.Append(" and Data.LoginID = @LoginID");
        //                    cmd.Parameters.Add("@LoginID", SqlDbType.VarChar).Value = string.Format("{0}", userID);
        //                }

        //                cmd.CommandText = sbSql.ToString();
        //                bool isParticipate = false;
        //                try
        //                {
        //                    isParticipate = Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd)) > 0;
        //                }
        //                catch (Exception)
        //                {
        //                    isParticipate = false;
        //                }
        //                return isParticipate;
        //            }
        //        }
        //        #endregion

        //        #region 审批通过盘
        //        public static void TaskAuditAgree(string relationID, string userID, string taskID)
        //        {
        //            bool bResult = false;
        //            PartyATMSaveAndTake pst = new PartyATMSaveAndTake();
        //            pst.ID = relationID;
        //            pst.Load();
        //            if (pst.AdminAudit.Equals("0"))
        //            {
        //                pst.Status = "2";
        //                pst.AdminAudit = "1";
        //                pst.UserAudit = "2";
        //            }
        //            else
        //            {
        //                pst.Status = "1";
        //                int userAudit = 0;
        //                try
        //                {
        //                    userAudit = Convert.ToInt32(pst.UserAudit);
        //                }
        //                catch (Exception)
        //                {
        //                    userAudit = 0;
        //                }
        //                pst.UserAudit = (userAudit + 1).ToString();
        //            }
        //            if (pst.UserAudit.Equals("2"))
        //            {
        //                pst.Status = "2";
        //            }
        //            pst.Createby = userID;
        //            pst.CreateTime = DateTime.Now;
        //            pst.Description = "";
        //            pst.IsSub = false;
        //            pst.IsSync = "0";
        //            bResult = PartyATMSaveAndTake.AddATMSaveAndTake(pst);

        //            PartyATMSaveThings st = new PartyATMSaveThings();
        //            st.ID = pst.SaveID;
        //            st.Load();
        //            PartyATMTakeThings tt = new PartyATMTakeThings();
        //            tt.ID = pst.TakeID;
        //            tt.Load();
        //            if (bResult)
        //            {
        //                TaskDoneByTaskID(taskID, userID);
        //                if (pst.AdminAudit.Equals("1") && pst.UserAudit.Equals("2"))
        //                {
        //                    AddTask(relationID, "爱心活动", "爱心柜员机", userID,
        //                        new string[] { st.Createby, tt.Createby }, "../../../PersonalCenter/Module/ATM/ATMMatchManagerAudit.aspx?RelationID=" + pst.ID
        //                        + "&LoginID=" + userID + "&BranchID=", "Member");
        //                }
        //            }
        //        }

        //        public static bool AddTask(string relationID, string title, string category, string fromUser, string[] toUsers, string taskUrl, string taskSpecie, string source = "本组织")
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                string strSql = @"INSERT INTO dbo.tblPartyTask (TaskID, RelationID, Category, TaskType, Title, FromUser, ToUser, TaskUrl, CreateTime,TaskSpecie,Source)
        //                                    VALUES (@TaskID{0}, @RelationID, @Category, @TaskType, @Title, @FromUser, @ToUser{0}, @TaskUrl{0}, GETDATE(),@TaskSpecie{0}, @Source);";
        //                for (int i = 0; i < toUsers.Length; i++)
        //                {
        //                    string taskID = StringHelper.NewID;
        //                    string tmpTaskUrl = "";
        //                    sbSql.AppendFormat(strSql, i);
        //                    cmd.Parameters.Add(string.Format("@ToUser{0}", i), System.Data.SqlDbType.VarChar).Value = string.IsNullOrEmpty(toUsers[i]) ? "" : toUsers[i];
        //                    cmd.Parameters.Add(string.Format("@TaskID{0}", i), System.Data.SqlDbType.VarChar).Value = taskID;

        //                    if (taskUrl.IndexOf("?") > 0)
        //                        tmpTaskUrl = taskUrl + "&TaskID=" + taskID;
        //                    else
        //                        tmpTaskUrl = taskUrl + "?TaskID=" + taskID;
        //                    cmd.Parameters.Add(string.Format("@TaskUrl{0}", i), System.Data.SqlDbType.VarChar).Value = tmpTaskUrl;
        //                    cmd.Parameters.Add(string.Format("@TaskSpecie{0}", i), System.Data.SqlDbType.VarChar).Value = taskSpecie;
        //                }

        //                cmd.Parameters.Add("@RelationID", System.Data.SqlDbType.VarChar).Value = relationID;
        //                cmd.Parameters.Add("@Category", System.Data.SqlDbType.VarChar).Value = category;
        //                cmd.Parameters.Add("@TaskType", System.Data.SqlDbType.VarChar).Value = "1";
        //                cmd.Parameters.Add("@Title", System.Data.SqlDbType.VarChar).Value = title;
        //                cmd.Parameters.Add("@FromUser", System.Data.SqlDbType.VarChar).Value = fromUser;
        //                cmd.Parameters.Add("@Source", System.Data.SqlDbType.VarChar).Value = source;
        //                if (sbSql.Length > 0)
        //                {
        //                    cmd.CommandText = sbSql.ToString();
        //                    return SXT.DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //                }
        //                else
        //                {
        //                    return false;
        //                }
        //            }

        //        }
        //        #endregion

        //        #region 任务变成已办
        //        /// <summary>
        //        /// 任务变成已办
        //        /// </summary>
        //        /// <param name="relationID"></param>
        //        /// <returns></returns>
        //        public static bool TaskDoneByTaskID(string taskID, string handler)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"UPDATE dbo.tblPartyTask SET TaskType = 5,Handler = @Handler WHERE TaskID = @TaskID;";
        //                cmd.Parameters.Add("@TaskID", System.Data.SqlDbType.VarChar).Value = taskID;
        //                cmd.Parameters.Add("@Handler", System.Data.SqlDbType.VarChar).Value = handler;
        //                return SXT.DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }

        //        /// <summary>
        //        /// 任务变成已办
        //        /// </summary>
        //        /// <param name="relationID"></param>
        //        /// <param name="handler">处理人</param>
        //        /// <returns></returns>
        //        public static bool TaskDone(string relationID, string handler)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"UPDATE dbo.tblPartyTask SET TaskType = 5,Handler = @Handler WHERE RelationID = @RelationID ;";
        //                cmd.Parameters.Add("@RelationID", System.Data.SqlDbType.VarChar).Value = relationID;
        //                cmd.Parameters.Add("@Handler", System.Data.SqlDbType.VarChar).Value = handler;
        //                return SXT.DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }

        //        public static bool Disagree(string relationID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.Append(string.Format(@"update tblPartyATMSaveThings set Status = 0 where ID in (select SaveID from tblPartyATMSaveAndTake where ID = '{0}');
        //update tblPartyATMTakeThings set Status = 0 where ID in (select TakeID from tblPartyATMSaveAndTake where ID = '{0}');
        //delete from tblPartyATMSaveAndTake where ID = '{0}';", relationID));
        //                cmd.CommandText = sbSql.ToString();
        //                try
        //                {
        //                    return Convert.ToInt32(SXT.DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd)) > 0;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        #endregion

        //        #region 获取签到活动列表
        //        /// <summary>
        //        /// 获取签到活动列表
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetBranchActivitieAttendList(string userID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            string dtStr = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";

        //            field = string.Format(@" pm.ID as meeting_id, pm.title, pm.ActivitieTime as [time], pm.ActivitieAddr as [address],
        //(select COUNT(*) from tblPartyBranchActivitieAttend where AttendType='签到确认' and ID = pa.ID) as signs,
        //(select COUNT(*) from tblPartyBranchActivitieAttend where AttendType='签到确认' and ID = pa.ID and LoginID = '{0}') as have_sign", userID);
        //            table = string.Format("tblPartyBranchActivitie pm inner join tblPartyBranchActivitieAttend pa on pm.ID = pa.ID and pa.AttendType='报名确认' and pa.LoginID='{0}'", userID);
        //            where = "  pm.ActivitieTime >='" + dtStr + "' ";
        //            orderBy = "pm.ActivitieTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取签到党课列表
        //        /// <summary>
        //        /// 获取签到党课列表
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetCoursesAttendList(string userID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            string dtStr = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";

        //            field = string.Format(@" pm.ID as meeting_id, pm.title, pm.CoursesTime as [time], pm.CoursesAddr as [address],
        //(select COUNT(*) from tblPartyMyCoursesAttend where AttendType='签到确认' and ID = pa.ID) as signs,
        //(select COUNT(*) from tblPartyMyCoursesAttend where AttendType='签到确认' and ID = pa.ID and LoginID = '{0}') as have_sign", userID);
        //            table = string.Format("tblPartyMyCourses pm inner join tblPartyMyCoursesAttend pa on pm.ID = pa.ID and pa.AttendType='报名确认' and pa.LoginID='{0}'", userID);
        //            where = "  pm.CoursesTime >='" + dtStr + "' ";
        //            orderBy = "pm.CoursesTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取签到会议列表
        //        /// <summary>
        //        /// 获取签到会议列表
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetMeetingAttendList(string userID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            string dtStr = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";

        //            field = string.Format(@" pm.ID as meeting_id, pm.title, pm.MeetingTime as [time], pm.MeetingAddr as [address],
        //(select COUNT(*) from tblPartyMyMeetingAttend where AttendType='签到确认' and ID = pa.ID) as signs,
        //(select COUNT(*) from tblPartyMyMeetingAttend where AttendType='签到确认' and ID = pa.ID and LoginID = '{0}') as have_sign", userID);
        //            table = string.Format("tblPartyMyMeeting pm inner join tblPartyMyMeetingAttend pa on pm.ID = pa.ID and pa.AttendType='报名确认' and pa.LoginID='{0}'", userID);
        //            where = "  pm.MeetingTime >='" + dtStr + "' ";
        //            orderBy = "pm.MeetingTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取签到会议,党课,支部活动列表
        //        /// <summary>
        //        /// 获取签到会议,党课,支部活动列表
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetAllAttendList(string userID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            string dtStr = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";

        //            field = string.Format(@"*");
        //            table = string.Format(@"(select '3' as [type],pm.ID as meeting_id, pm.title, pm.ActivitieTime as [time], pm.ActivitieAddr as [address],
        //(select COUNT(*) from tblPartyBranchActivitieAttend where AttendType='签到确认' and ID = pa.ID) as signs,
        //(select COUNT(*) from tblPartyBranchActivitieAttend where AttendType='签到确认' and ID = pa.ID and LoginID = '{0}') as have_sign
        //from tblPartyBranchActivitie pm inner join tblPartyBranchActivitieAttend pa on pm.ID = pa.ID and pa.AttendType='参加确认' and pa.LoginID='{0}'
        //where pm.ActivitieTime >='{1}' 
        //union
        //select '2' as [type],pm.ID as meeting_id, pm.title, pm.CoursesTime as [time], pm.CoursesAddr as [address],
        //(select COUNT(*) from tblPartyMyCoursesAttend where AttendType='签到确认' and ID = pa.ID) as signs,
        //(select COUNT(*) from tblPartyMyCoursesAttend where AttendType='签到确认' and ID = pa.ID and LoginID = '{0}') as have_sign
        //from tblPartyMyCourses pm inner join tblPartyMyCoursesAttend pa on pm.ID = pa.ID and pa.AttendType='参加确认' and pa.LoginID='{0}'
        //where pm.CoursesTime >='{1}' 
        //union 
        //select  '1' as [type], pm.ID as meeting_id, pm.title, pm.MeetingTime as [time], pm.MeetingAddr as [address],
        //(select COUNT(*) from tblPartyMyMeetingAttend where AttendType='签到确认' and ID = pa.ID) as signs,
        //(select COUNT(*) from tblPartyMyMeetingAttend where AttendType='签到确认' and ID = pa.ID and LoginID = '{0}') as have_sign
        //from tblPartyMyMeeting pm inner join tblPartyMyMeetingAttend pa on pm.ID = pa.ID and pa.AttendType='参加确认' and pa.LoginID='{0}'
        //where pm.MeetingTime >='{1}') aa ", userID, dtStr);
        //            where = "";
        //            orderBy = "[time]";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 会议签到
        //        /// <summary>
        //        /// 会议签到
        //        /// </summary>
        //        /// <param name="userID">用户ID</param>
        //        /// <param name="meetingID">会议ID</param> 
        //        /// <returns></returns>
        //        public static bool MeetingSignIn(string userID, string meetingID)
        //        {
        //            string strSql = string.Format(@"if not exists(select * from tblPartyMyMeetingAttend where ID='{0}' and LoginID='{1}' and AttendType='{2}')
        //insert into tblPartyMyMeetingAttend(ID,LoginID,CreateTime,Remark,AttendType) select ID,LoginID,GETDATE(),Remark,'{2}' 
        //from tblPartyMyMeetingAttend where AttendType='报名确认' and ID = '{0}' and LoginID in ('{1}');"
        //                , meetingID, userID, "签到确认");
        //            bool rt = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(strSql) > 0;
        //            return rt;
        //        }
        //        #endregion

        #region 获取用户党费缴纳信息
        /// <summary>
        /// 获取用户党费缴纳信息
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="year">查询年份</param> 
        /// <returns></returns>
        public static DataSet GetPartyMemberCost(string userID, string year)
        {
            string strSql = string.Format(@"select month,cost as money, '1' as status from tblPartyMemberCost where LoginID = '{0}' and YEAR = '{1}' order by month"
                , userID, year);

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(strSql);
        }
        #endregion

        #region 获取礼仪歌曲、党务流程指引附件列表信息
        /// <summary>
        /// 获取礼仪歌曲、党务流程指引附件列表信息
        /// </summary>
        /// <param name="type">类别 1：礼仪歌曲，2：党务流程指引</param> 
        /// <returns></returns>
        public static DataSet GetPartyFlowAndMusicList(string type, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            if (type == "1")
            {
                where = " 1=1 and article.category = 'Classical' ";
            }
            else if (type == "2")
            {
                where = " 1=1 and article.category = 'ProcessGuide' ";
            }
            else
            {
                return new DataSet();
            }
             
            field = @"article.ID as file_id,article.Title as name, '' as type, partyfile.Size,  partyfile.url  ";
            table = @"tblpartyarticle article LEFT JOIN tblpartyfile partyfile ON article.ImageID=partyfile.ID";
            orderBy = "article.createtime desc";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }


        //public static DataSet GetPartyMusicList(string type, int page_no, int page_count)
        //{
        //    string field = string.Empty;
        //    string table = string.Empty;
        //    string where = string.Empty;
        //    string orderBy = string.Empty;

        //    field = @"ID as [file_id], title as name, '' as [type], '' as size, fileid as url";
        //    table = @"tblPartyJBPartyMusic";
        //    if (type == "1")
        //        where = "Category = '礼仪歌曲'";
        //    else
        //        where = "Category = '金曲欣赏'";
        //    orderBy = " CreateTime desc ";

        //    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //}
        #endregion

        #region 获取党史上的今天信息内容列表
        /// <summary>
        /// 获取党史上的今天信息内容列表
        /// </summary>
        /// <param name="month"></param>
        /// <param name="day"></param>
        /// <returns></returns>
        public static DataSet GetPartyHistoryTodayList(string month, string day)
        {
            string strSql = string.Format("select content from tblpartyhistorytoday where month='{0}' and day='{1}' order by CreateTime desc", month, day);
            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(strSql);
        }
        #endregion
        //        #endregion

        //        #region 留影墙
        #region 获取留影墙照片类别列表
        /// <summary>
        /// 获取留影墙照片类别列表
        /// </summary> 
        /// <returns></returns>
        public static DataSet GetPartyPhotoTypeList()
        {
            string strSql = string.Format("SELECT DDicmember AS type_id, DDicmemberName AS NAME FROM tbldatadictionary WHERE ddictype = 'ZHDJ.PhotoWall.Category' ORDER BY orderno");
            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(strSql);
        }
        #endregion

        #region 获取留影墙列表
        /// <summary>
        /// 获取留影墙列表
        /// </summary>
        /// <param name="category"></param>
        /// <param name="page_no"></param>
        /// <param name="page_count"></param>
        /// <returns></returns>
        public static DataSet GetPartyPhotoList(string category, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = @"a.sourceID AS source,a.ID AS wall_id, a.Title AS NAME, a.Content AS wall_desc, b.UserName AS author,
         a.BranchID AS branch_id, c.BranchName AS branch_name, a.CreateTime AS create_time,
         (SELECT d.FileID FROM tblpartyphotowallimage d WHERE d.PhotoWallID = a.ID ORDER BY d.CreateTime LIMIT 1) AS cover_img ";
            table = @"tblpartyphotowall a
         LEFT JOIN tblPartyOrgMember b ON a.CreateBy = b.LoginID
         LEFT JOIN tblPartyOrgBranch c ON a.BranchID = c.BranchID";

            //if (category == "群众路线教育实践")
            //    where += "a.IsPassAudit=1 and a.Thematic != ''";
            //else
                where += "a.Status = 4 and a.Aduit = 2 and  a.Category = '" + category + "'";
            orderBy = "a.CreateTime desc ";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion


                #region 获取留影墙列表
        //        /// <summary>
        //        /// 获取留影墙列表
        //        /// </summary>
        //        /// <param name="category"></param>
        //        /// <param name="key"></param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyPhotoFindList(string category, string key, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            string fileEx = "";

        //            if (!string.IsNullOrEmpty(key))
        //                fileEx += string.Format(@"and (a.title like '%{0}%' or a.content like '%{0}%' or b.username like '%{0}%' or c.BranchName like '%{0}%'
        //     or a.id in (select databaseid from tblPartyDatabaseComment where imagedesc like '%{0}%'))", key);

        //            field = @"a.source,a.ID as wall_id, a.Title as name, a.Content as wall_desc, b.UserName as author,
        // a.BranchID as branch_id, c.BranchName as branch_name, a.CreateTime as create_time,
        // (select top 1 d.URL from tblPartyDatabaseAttachment d where d.ID = a.ID order by d.CreateTime) as cover_img";
        //            table = @"tblPartyDatabase a
        // left join tblPartyOrgMembers b on a.CreateBy = b.LoginID
        // left join tblPartyOrgBranch c on a.BranchID = c.BranchID";

        //            if (category == "群众路线教育实践")
        //                where = "a.IsPassAudit=1 and a.Thematic != '' " + fileEx;
        //            else
        //                where = "a.IsPassAudit=1 and a.Category = '" + category + "'" + fileEx;

        //            orderBy = "a.CreateTime desc ";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
               #endregion

        #region 获取留影墙照片列表
        /// <summary>
        /// 获取留影墙照片列表
        /// </summary>
        /// <param name="id"></param>
        /// <param name="page_no"></param>
        /// <param name="page_count"></param>
        /// <returns></returns>
        public static DataSet GetPartyPhotoPicList(string id, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = @"da.PhotoWallID as photoWall_id, da.ID as photo_id, pFile.Title as name, da.FileID as URL, 
        (select COUNT(*) from tblpartycomment where RelationID=da.photowallid) as comments";
            table = "tblpartyphotowallimage da LEFT JOIN tblpartyfile pFile ON da.FileID = pFile.ID";
            where = "da.photowallid='" + id + "'  ";
            orderBy = "da.CreateTime desc";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        #region 留影墙类别是否存在
        public static bool CheckPartyPhotoType(string type)
        {
            string sqlLoginID = "select count(DDicmember) FROM tbldatadictionary WHERE ddictype = 'ZHDJ.PhotoWall.Category'  and DDicmember='" + type + "' ";
            return Convert.ToInt32(ZHDJ.Data.MySqlHelper.ExecuteScalar(sqlLoginID)) > 0;
        }
        #endregion

        //        #region 留影墙是否存在
        //        public static bool CheckPartyPhotoPic(string title)
        //        {
        //            string sqlLoginID = "select COUNT(*) from tblPartyDatabase where Title='" + title + "'";
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sqlLoginID)) > 0;
        //        }
        public static bool CheckPartyPhotoPicEx(string id)
        {
            string sqlLoginID = "select COUNT(*) from tblpartyphotowall where ID='" + id + "'";
            return Convert.ToInt32(ZHDJ.Data.MySqlHelper.ExecuteScalar(sqlLoginID)) > 0;
        }
        //        #endregion

        #region 保存留影墙照片上传信息
        /// <summary>
        /// 保存留影墙照片上传信息
        /// </summary> 
        /// <returns></returns>
        public static bool InsertPartyPhotoPicUploadInfo(string wallID, List<UpFileInfo> uploadFile, string userID)
        {
            string sql = "";

            for (int i = 0; i < uploadFile.Count; i++)
            {
                sql += string.Format(@" INSERT INTO tblpartyphotowallimage(ID, PhotoWallID, FileID, `DESCRIBE`, `STATUS`, OrderNo, 
                                            CreateTime, CreateBy, ModifyTime, ModifyBy)
                                        VALUES('{0}', '{1}', '{2}', '', '0', 0, '{3}',  '{4}', '{3}',  '{4}');", 
                                         StringHelper.NewID, wallID, uploadFile[i].url, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), userID);
            }

            //AddPushData(wallID, "DQFC", "tblPartyDatabase", "Add", new string[] { "SWZH" }, "", "", "");
            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 保存留影墙以及照片上传信息
        /// <summary>
        /// 保存留影墙以及照片上传信息
        /// </summary> 
        /// <returns></returns>
        public static bool InsertPhotoCreateAndPicUploadInfo(string user_id, string type_id, string name, string desc, string isThematicImg, List<UpFileInfo> uploadFile)
        {
            string id = StringHelper.NewID;
            string sql = "";

            if (isThematicImg == "1")
            {
                #region 注释
                //        if (user_id.ToLower() == "admin")
                //        {
                //            sql = string.Format(@"insert into tblPartyDatabase(ID,Title,Content,URL,Category,
                //[Type],CreateTime,[Status],BranchID,IsPassAudit,
                //CreateBy,Source,IsShowInHomePage,Thematic,IsTop,SuperTop,PageFrom)
                //select '{0}','{1}','{2}', '', '{3}',
                //'Photo',GETDATE(), '0', BranchID, 1,
                //'{4}','手机', '1', 'b6f95ebf9dae4f1f9c471a2a479c3c22', '0','0','ThematicImg' from tblPartyOrgMembers where LoginID = '{4}';", id, name, desc, type_id,
                //                                                                       user_id);
                //        }
                //        else
                //        {
                //            sql = string.Format(@"insert into tblPartyDatabase(ID,Title,Content,URL,Category,
                //[Type],CreateTime,[Status],BranchID,IsPassAudit,
                //CreateBy,Source,IsShowInHomePage,Thematic,IsTop,SuperTop,PageFrom)
                //select '{0}','{1}','{2}', '', '{3}',
                //'Photo',GETDATE(), '0', BranchID, 0,
                //'{4}','手机', '1', 'b6f95ebf9dae4f1f9c471a2a479c3c22', '0','0','ThematicImg' from tblPartyOrgMembers where LoginID = '{4}';", id, name, desc, type_id,
                //                                                                       user_id);
                //        }
                #endregion
            }
            else
            {
                sql = string.Format(@"INSERT INTO tblpartyphotowall(ID, Title, BranchID, Content, category, STATUS, Aduit, 
                                        Flags, SourceID, IsPush, CreateTime,CreateBy, ModifyTime, ModifyBy)
                                        select '{0}', '{1}', BranchID, '{2}', '{3}', 4, 2, 
                                        0, 2, false, '{4}',loginid, '{4}',loginid from tblPartyOrgMember WHERE loginid = '{5}';", 
                                        id, name, "", type_id, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), user_id);
            }
              
            for (int i = 0; i < uploadFile.Count; i++)
            {
                sql += string.Format(@" INSERT INTO tblpartyphotowallimage(ID, PhotoWallID, FileID, `DESCRIBE`, `STATUS`, OrderNo, 
                                            CreateTime, CreateBy, ModifyTime, ModifyBy)
                                        VALUES('{0}', '{1}', '{2}', '', '0', 0, '{3}',  '{4}', '{3}',  '{4}');",
                                         StringHelper.NewID, id, uploadFile[i].url, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), user_id);
            }

            //AddPushData(id, "DQFC", "tblPartyDatabase", "Add", new string[] { "SWZH" }, "", "", user_id);

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 获取留影墙评论列表
        /// <summary>
        /// 获取留影墙评论列表
        /// </summary>
        /// <param name="photo_id"></param>
        /// <param name="page_no"></param>
        /// <param name="page_count"></param>
        /// <returns></returns>
        public static DataSet GetPartyPhotoPicCommentList(string wall_id, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = "a.CreateBy as user_id, b.ImageUrl as head_img, a.createtime as time,content, b.UserName as user_name,a.imageid as imageUrl,a.imagedesc as imageAddr";
            table = "tblpartycomment a left join tblpartyorgmember b on a.CreateBy=b.LoginID ";
            where = "a.RelationID = '" + wall_id + "' ";
            orderBy = "a.createtime desc";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        #region 保存留影墙评论
        public static bool InsertPartyDatabaseComment(string dataBaseID, string commentLoginID, string content, string fileID, string imgAddr)
        {
            string sql = string.Format(@"INSERT INTO tblpartycomment(ID, RelationID, Content, ImageID, ImageDesc, Module, DataCreateType, CreateTime, CreateBy)
                                        VALUES('{0}', '{1}', '{2}', '{3}', '{4}', 'LYQ', 2, '{5}', '{6}')", 
                                        StringHelper.NewID, dataBaseID, content, fileID, imgAddr, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), commentLoginID);

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion
        //        #endregion

        //        #region 群
        //        #region 判断指定人员是否已经参加活动
        //        public static bool IsHaveJoinActivity(string userID, string activityD)
        //        {
        //            string sql = string.Format(@"select count(*) from tblMSActivityMember where ActivityID='{0}' and USerID='{1}'", activityD, userID);
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }
        //        #endregion

        //        #region 判断活动是否已经满员
        //        public static DataSet GetActivityMemberNumInfo(string ActivityID)
        //        {
        //            string sql = string.Format(@"select a.ActivityStatus, a.maxMemberNum,  (select COUNT(*) from tblMSActivityMember b where b.ActivityID=a.ActivityID) as CurrentMemberNum 
        //from tblMSCircleActivity a where ActivityID='{0}'", ActivityID);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 判断指定人员是否加入了指定圈子
        //        public static bool CheckMSCircle(string userID, string circleID)
        //        {
        //            string sql = string.Format(@" select COUNT(*) from(
        //select CircleID from tblMSCircleMember where UserID='{0}' and CircleID='{1}'
        //union
        //select CircleID from tblMSCircle where CreateBy='{0}' and CircleID='{1}') aa", userID, circleID);
        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }
        //        #endregion

        //        #region 判断指定人员是否是圈子创建者
        //        public static bool CircleIsCreateByUser(string circleID, string userID)
        //        {
        //            string sql = string.Format(" select COUNT(*) from tblMSCircle where CircleID='{0}' and CreateBy='{1}'", circleID, userID);

        //            return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }
        //        #endregion

        //        #region 判断圈子是否存在并启用
        //        public static bool CheckMSCircleStatus(string circleID)
        //        {
        //            string sql = " select CircleStatus from tblMSCircle where CircleID='" + circleID + "'";

        //            object obj = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql);

        //            if (obj == null)
        //                return false;

        //            if (obj.ToString() == "1")
        //                return true;
        //            else
        //                return false;
        //        }
        //        #endregion

        //        #region 判断圈子是否已经满员,圈子状态，圈子是否存在，圈子是否可解散
        //        public static DataSet GetCircleMemberNumInfo(string circleID)
        //        {
        //            string sql = string.Format(@"select CreateBy,CircleType,CircleStatus, MaxMemberNum, (select COUNT(*) 
        //from tblMSCircleMember b where b.CircleID=a.CircleID) as CurrentMemberNum 
        //from tblMSCircle a  where a.CircleID='{0}'", circleID);

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 判断圈子是否已经存在
        //        public static bool CircleIsExists(string circleName)
        //        {
        //            string sql = string.Format(@"select COUNT(*) from tblMSCircle where CircleName = '{0}'", circleName);

        //            return Convert.ToInt32(DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }
        //        #endregion

        //        #region 判断标签是否已经存在
        //        public static bool TagIsExistsByName(string TagName)
        //        {
        //            string sql = string.Format(@"select COUNT(*) from tblMSTag where TagName = '{0}'", TagName);

        //            return Convert.ToInt32(DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }

        //        public static bool TagIsExistsByID(string TagID)
        //        {
        //            string sql = string.Format(@"select COUNT(*) from tblMSTag where TagID = '{0}'", TagID);

        //            return Convert.ToInt32(DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }
        //        #endregion

        //        #region 获取标签状态
        //        public static string GetTagStatus(string TagID)
        //        {
        //            string sql = string.Format(@"select TagStatus from tblMSTag where TagID='{0}'", TagID);

        //            object obj = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql);

        //            if (obj == null)
        //                return "";
        //            else
        //                return obj.ToString();
        //        }
        //        #endregion

        //        #region 是否已经对标签进行过投票
        //        public static bool IsHaveVoteForTag(string TagID, string userID)
        //        {
        //            string sql = string.Format(@"select COUNT(*) from tblMSTagVote where UserID ='{0}' and TagID='{1}'", userID, TagID);

        //            return Convert.ToInt32(DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql)) > 0;
        //        }
        //        #endregion

        //        #region 获取我的圈子列表
        //        public static DataSet GetMyCircleList(string userID)
        //        {
        //            string sql = string.Format(@"select aa.*, bb.TagName,om.UserName as createName  from (
        //select a.CircleID as community_id, b.CircleName as name, b.CurrentMemberNum as numbers,
        //b.CircleTag as labels, b.CircleDesc as info,b.circletype,a.JoinTime, '' as applyNum,b.CreateBy as create_userid from tblMSCircleMember a
        //inner join tblMSCircle b on a.CircleID = b.CircleID
        // where a.UserID ='{0}' and a.IsCreate != '1' 
        // union 
        // select c.CircleID as community_id, c.CircleName as name, c.CurrentMemberNum as numbers,
        //c.CircleTag as labels, c.CircleDesc as info, '2' as circletype, c.CreateTime as JoinTime,
        //(select count(*) from tblMSCircleApply e where e.CircleID=c.CircleID) as applyNum,c.CreateBy as create_userid
        //from tblMSCircle c where c.CreateBy = '{0}'
        //) aa
        //left join tblMSTag bb
        //on aa.labels = bb.TagID
        //left join tblPartyOrgMembers om on om.LoginID = aa.create_userid
        // order by aa.JoinTime ", userID);
        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取用户可参与的活动列表信息
        //        /// <summary>
        //        /// 获取用户可参与的活动列表信息
        //        /// </summary>
        //        /// <param name="userID"></param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetMyActivityAbleList(string userID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"c.ActivityID as id, c.ActivityName as name, c.CircleID as community_id,
        //b.CircleName as community_name, d.UserName as creater, c.ActivityAddr as [address],
        //c.ActivityTime as [time],c.ActivityRule as content, c.ActivityEndTime ";
        //            table = @"tblMSCircleMember a
        //inner join tblMSCircle b on a.CircleID = b.CircleID
        //inner join tblMSCircleActivity c on b.CircleID = c.CircleID
        //left join tblPartyOrgMembers d on C.CreateBy = d.LoginID  ";
        //            where = "a.UserID = '" + userID + "' ";
        //            orderBy = "c.CreateTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取圈子动态信息
        //        /// <summary>
        //        /// 获取圈子动态信息
        //        /// </summary>
        //        /// <param name="type">信息类别 1：留言，2：活动</param>
        //        /// <param name="circleID"></param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetCircleDynamicInfoList(string type, string circleID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            if (type == "1")
        //            {
        //                field = @"b.UserID as [user_id], c.UserName as [user_name], c.ImageUrl as user_head,
        //b.CreateTime as publish_time, b.content as msg_content, 
        //'' as activity_id, '' as activity_name, '' as activity_addr,'' as activity_time,'' as activity_content,'' as enter_nums,
        //(case c.runSate when '-1' then '0' else '1' end ) as Is_party_member, '' as ActivityEndTime";
        //                table = @"tblMSCircle a
        //inner join tblMSCircleComments b on a.CircleID = b.CircleID
        //left join tblPartyOrgMembers c on b.UserID = c.LoginID";
        //                where = "a.CircleID ='" + circleID + "'";
        //                orderBy = "b.CreateTime desc";

        //                return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //            }
        //            else if (type == "2")
        //            {
        //                field = @"b.ActivityName as activity_name,b.ActivityID as activity_id, b.ActivityAddr as activity_addr, b.ActivityTime as activity_time,
        //b.ActivityRule as activity_content, b.currentMemberNum as enter_nums,
        //b.CreateBy as [user_id], c.UserName as [user_name], c.ImageUrl as user_head,
        //'' as publish_time, '' as msg_content, 
        //(case c.runSate when '-1' then '0' else '1' end ) as Is_party_member,b.ActivityEndTime ";
        //                table = @"tblMSCircle a
        //inner join tblMSCircleActivity b on a.CircleID=b.CircleID
        //left join tblPartyOrgMembers c on b.CreateBy = c.LoginID ";
        //                where = "a.CircleID ='" + circleID + "' and b.ActivityEndTime >= GETDATE() ";
        //                orderBy = "b.CreateTime desc";

        //                return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //            }
        //            else
        //            {
        //                return null;
        //            }
        //        }
        //        #endregion

        //        #region 获取活动报名人数列表
        //        public static DataSet GetCircleActivityMemberList(string activityID, int page_no, int page_count)
        //        {
        //            //            string sql = string.Format(@"select a.USerID as [user_id], b.UserName as cname, b.ImageUrl as user_head,
        //            //(case b.runSate when '-1' then '2' else '1' end) as user_type from tblMSActivityMember a
        //            //left join tblPartyOrgMembers b on a.USerID = b.LoginID 
        //            //where a.ActivityID = '{0}' order by a.JoinTime desc", activityID);
        //            //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);

        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"a.USerID as [user_id], b.UserName as cname, b.ImageUrl as user_head,
        //(case b.runSate when '-1' then '2' else '1' end) as user_type";
        //            table = @"tblMSActivityMember a
        //left join tblPartyOrgMembers b on a.USerID = b.LoginID ";
        //            where = "a.ActivityID = '" + activityID + "'";
        //            orderBy = "a.JoinTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 发表圈子留言
        //        public static bool InsertMSCircle(string userID, string circleID, string content)
        //        {
        //            string sql = string.Format(@" insert into tblMSCircleComments(ID,CircleID,UserID,UserName,content,CreateTime) 
        // select top 1 (REPLACE(newid(), '-', '')), '{1}', '{0}', UserName, '{2}', GETDATE() 
        // from tblPartyOrgMembers where LoginID ='{0}'", userID, circleID, content);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 发表圈子活动
        //        public static bool InsertMSCircleActivity(string activityName, string activityTime, string activityAddr, string activityRule,
        //            string createBy, string circleID, string endTime)
        //        {
        //            string id = StringHelper.NewID;
        //            activityTime = Convert.ToDateTime(activityTime).ToString("yyyy-MM-dd HH:mm:ss");
        //            endTime = Convert.ToDateTime(endTime).ToString("yyyy-MM-dd HH:mm:ss");
        //            string sql = string.Format(@" insert into tblMSCircleActivity(ActivityID,ActivityName,CircleID,ActivityTime,ActivityAddr,
        //ActivityRule,CreateTime,CreateBy,ActivityStatus,maxMemberNum,currentMemberNum, ActivityEndTime)
        //select '{6}',(case a.CircleType when '1' then b.TagName else '{0}' end) , 
        //a.CircleID, '{1}', '{2}', '{3}', GETDATE(), '{4}', '1', a.MaxMemberNum, 1, '{7}'  
        //from tblMSCircle a
        //left join tblMSTag b on a.CircleTag=b.TagID  where a.CircleID='{5}';
        //insert into tblMSActivityMember (ID,ActivityID,USerID,JoinTime)
        //values(REPLACE(NEWID(), '-',''), '{6}', '{4}', GETDATE())", activityName, activityTime, activityAddr, activityRule, createBy, circleID, id, endTime);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 获取圈子成员列表信息
        //        /// <summary>
        //        /// 获取圈子成员列表信息
        //        /// </summary> 
        //        /// <param name="circleID"></param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetCircleMemberList(string circleID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"a.UserID as [user_id], b.UserName as cname, b.ImageUrl as head_img,
        //(case b.runSate when '-1' then '2' when '' then '' else '1' end) as [type], a.IsCreate as is_create ";
        //            table = @"tblMSCircleMember a left join tblPartyOrgMembers b on a.UserID = b.LoginID";
        //            where = "a.CircleID='" + circleID + "'";
        //            orderBy = "a.JoinTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取圈子申请成员列表信息
        //        /// <summary>
        //        /// 获取圈子申请成员列表信息
        //        /// </summary> 
        //        /// <param name="circleID"></param> 
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetCircleApplyMemberList(string circleID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"a.ApplyUser as [user_id], b.UserName as cname, b.ImageUrl as head_img,
        //(case b.runSate when '-1' then '2' when '' then '' else '1' end) as [type] ";
        //            table = @"tblMSCircleApply a left join tblPartyOrgMembers b on a.ApplyUser = b.LoginID";
        //            where = "a.CircleID='" + circleID + "'";
        //            orderBy = "a.ApplyTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 圈子成员管理
        //        /// <summary>
        //        /// 圈子成员管理
        //        /// </summary>
        //        /// <param name="circleID"></param>
        //        /// <param name="memberID"></param>
        //        /// <param name="opUserID"></param>
        //        /// <param name="opType">1：删除，2：审核通过，3：审核不通过</param>
        //        /// <returns></returns>
        //        public static bool CircleMemberManage(string circleID, string memberID, string opUserID, string opType)
        //        {
        //            string sql = "";
        //            if (opType == "1")
        //            {
        //                sql = string.Format(@"delete from tblMSCircleMember where UserID = '{0}' and CircleID='{1}';
        //update tblMSCircle set CurrentMemberNum=(select COUNT(*) from tblMSCircleMember where CircleID='{1}') where CircleID='{1}'", memberID, circleID);
        //            }
        //            else if (opType == "2")
        //            {
        //                sql = string.Format(@"if not exists(select * from tblMSCircleMember where CircleID='{0}' and UserID='{1}')
        //insert into tblMSCircleMember(ID,CircleID,UserID,JoinTime,AuditBy, IsCreate)
        //values (REPLACE(NEWID(), '-', ''), '{0}', '{1}', getdate(), '{2}', '2') ;
        //delete from tblMSCircleApply where CircleID='{0}' and ApplyUser='{1}';
        //update tblMSCircle set CurrentMemberNum=(select COUNT(*) from tblMSCircleMember where CircleID='{0}') where CircleID='{0}'", circleID, memberID, opUserID);
        //            }
        //            else if (opType == "3")
        //            {
        //                sql = "delete from tblMSCircleApply where CircleID='" + circleID + "' and ApplyUser='" + memberID + "'";
        //            }
        //            else
        //            {
        //                return false;
        //            }

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 获取所有的圈子列表信息
        //        /// <summary>
        //        /// 获取所有的圈子列表信息
        //        /// </summary> 　
        //        /// <returns></returns>
        //        public static DataSet GetAllCircleList(string keyword, string circleType, string userID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = string.Format(@"a.CircleID as community_id, a.CircleName as name,
        //(select COUNT(*) from tblMSCircleMember b where b.CircleID=a.CircleID) as numbers,
        //(select COUNT(*) from tblMSCircleMember c where c.CircleID=a.CircleID and c.UserID='{0}') as have_join,
        //(select COUNT(*) from tblMSCircleApply d where d.CircleID=a.CircleID and d.ApplyUser='{0}') as app_join, 
        //a.CircleTag as labels, a.CircleDesc as info, 
        //a.CreateBy as create_userid,om.UserName as createName, g.TagName ", userID);

        //            table = @" tblMSCircle a left join tblMSTag g on a.CircleTag=g.TagID
        //left join tblPartyOrgMembers om on om.LoginID = a.CreateBy ";

        //            where = "1=1";
        //            if (!string.IsNullOrEmpty(keyword))
        //                where += " and (a.CircleName like '%" + keyword + "%' or g.TagName like '%" + keyword + "%' )";

        //            if (circleType == "0" || circleType == "1")
        //                where += " and a.CircleType = '" + circleType + "' ";

        //            orderBy = "a.CreateTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 加入圈子
        //        public static bool ApplyJoinCircle(string userID, string circleID)
        //        {
        //            string sql = string.Format(@"insert into tblMSCircleApply(ApplyID, CircleID, ApplyUser, ApplyTime)
        //values(REPLACE(NEWID(), '-',''), '{0}', '{1}', GETDATE())", circleID, userID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 创建圈子
        //        public static bool CreateCircle(string CircleName, string CircleTag, string CircleDesc, string CreateBy)
        //        {
        //            //分为固定圈子和临时圈子2种类型 0 固定圈子，1 临时圈子 固定圈子的标签为空,临时圈子的标签不为空(只能创建临时)
        //            string CircleType = "1";
        //            string CircleTagName = "";
        //            string id = StringHelper.NewID;

        //            string sql = string.Format(@"insert into tblMSCircle(CircleID,CircleName,CircleType,CircleTag,CircleTagName,
        //CircleDesc,CreateTime,CreateBy,CircleStatus,MaxMemberNum,CurrentMemberNum)
        //values('{6}', '{0}', '{1}', '{2}', '{3}', 
        //'{4}', GETDATE(), '{5}', '1', 100, 1);
        // insert into tblMSCircleMember(ID,CircleID,UserID,JoinTime,AuditBy, IsCreate)
        //values (REPLACE(NEWID(), '-', ''), '{6}', '{5}', getdate(), '{5}', '1');", CircleName, CircleType, CircleTag, CircleTagName,
        //                                CircleDesc, CreateBy, id);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 删除圈子
        //        public static bool DeleteCircle(string CircleID)
        //        {
        //            string sql = string.Format(@"delete from tblMSCircle where CircleID='{0}'", CircleID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 退出圈子
        //        public static bool QuitCircle(string CircleID, string userID)
        //        {
        //            string sql = string.Format(@"delete from tblMSCircleMember where CircleID='{0}' and UserID ='{1}';
        //update tblMSCircle set CurrentMemberNum=(select COUNT(*) from tblMSCircleMember where CircleID='{0}') where CircleID='{0}'", CircleID, userID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 创建标签
        //        public static bool CreateTag(string TagName, string CreateBy)
        //        {
        //            string sql = string.Format(@"insert into tblMSTag(TagID,TagName,CreateBy,CreateTime,VoteNum,TagStatus)
        //values(REPLACE(newid(), '-', ''), '{0}', '{1}', getdate(), 0, '0')", TagName, CreateBy);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 获取标签列表
        //        /// <summary>
        //        /// 获取标签列表
        //        /// </summary>
        //        /// <param name="keyword"></param>
        //        /// <param name="type">1：所有，2：投票标签，3：热门标签, 4:已启用。</param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetTagInfoList(string keyword, string type, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = " 1=1 ";
        //            string orderBy = string.Empty;

        //            field = @"TagID as label_id, TagName as name, VoteNum as votes, TagStatus, '' as [order] ";
        //            table = @"tblMSTag";

        //            if (!string.IsNullOrEmpty(keyword))
        //                where += " and TagName like '%" + keyword + "%' ";

        //            if (type == "2")
        //            {
        //                where += " and TagStatus = '1' ";
        //                orderBy = "CreateTime desc";
        //                return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //            }
        //            else if (type == "3")
        //            {
        //                field = @"TagID as label_id, TagName as name, VoteNum as votes, TagStatus,
        //(select COUNT(*) from tblMSCircle where CircleTag = Tagid) as [order] ";
        //                where = " where " + where + " and TagStatus = '2' ";
        //                orderBy = "[order] desc";

        //                string sql = string.Format(@"select top 12 TagID as label_id, TagName as name, VoteNum as votes, TagStatus,
        //(select COUNT(*) from tblMSCircle where CircleTag = Tagid) as [order]  
        //from tblMSTag {0}  order by [order] desc", where);

        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //            }
        //            else if (type == "4")
        //            {
        //                where += " and TagStatus = '2' ";
        //                orderBy = "CreateTime desc";
        //                return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //            }
        //            else
        //            {
        //                orderBy = "CreateTime desc";
        //                return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //            }
        //        }
        //        #endregion

        //        #region 标签投票(包含标签启用)
        //        public static bool TagVote(string userID, string tagID)
        //        {
        //            string sql = string.Format(@"insert into tblMSTagVote(ID, TagID, UserID, CreateTime)
        //values(REPLACE(NEWID(), '-', ''), '{0}', '{1}', GETDATE());
        //update tblMSTag set VoteNum=(select COUNT(*) from tblMSTagVote where TagID='{0}') where TagID='{0}';
        //update tblMSTag set TagStatus = '2' where TagID='{0}' and TagStatus='1' and VoteNum >= 20;", tagID, userID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 获取圈子活动统计信息
        //        public static DataSet GetCircleActivityCount(string CircleID)
        //        {
        //            string sql = string.Format(@"select count(distinct a.ActivityID) as activity_count, count(b.ID) as join_numbers 
        //from tblMSCircleActivity a 
        //inner join tblMSActivityMember b on a.ActivityID = b.ActivityID
        //where a.CircleID = '{0}'", CircleID);
        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 加入活动
        //        public static bool JoinCircleActivity(string userID, string ActivityID)
        //        {
        //            string sql = string.Format(@"insert into tblMSActivityMember(ID, ActivityID, USerID, JoinTime)
        //values(REPLACE(NEWID(), '-', ''), '{0}', '{1}', GETDATE());
        //update tblMSCircleActivity set CurrentMemberNum=(select COUNT(*) from tblMSActivityMember where ActivityID='{0}') where ActivityID='{0}'", ActivityID, userID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion
        //        #endregion

        //        #region 论坛
        #region 帖子是否存在
        public static bool PartyForumIsExists(string forum_id)
        {
            string sql = "select COUNT(*) from tblPartyForum where ID='" + forum_id + "'";// AND ForumCategory='BBSOf71'";

            return Convert.ToInt32(ZHDJ.Data.MySqlHelper.ExecuteScalar(sql)) > 0;
        }
        #endregion

        public static int GetForumReplyCount(string forum_id)
        {
            string sql = "select count(*) from tblPartyForumReply where ForumID='" + forum_id + "'";

            return Convert.ToInt32(ZHDJ.Data.MySqlHelper.ExecuteScalar(sql));
        }

        #region 论坛分类是否存在
        public static bool PartyForumTypeIsExists(string typeID)
        {
            string sql = "select count(*) from tblPartyForumType where ID ='" + typeID + "'";

            return Convert.ToInt32(ZHDJ.Data.MySqlHelper.ExecuteScalar(sql)) > 0;
        }
        #endregion

        #region 获取论坛帖子详细信息
        public static DataSet GetPartyForumDetailInfo(string ForumID)
        {
            string sql = "";

            sql = string.Format(@"SELECT a.*,b.Title,c.UserName,d.ImageID AS ImageUrl FROM tblPartyForum a 
        LEFT JOIN tblPartyForumType b ON a.TypeID=b.ID
        LEFT JOIN tblpartyorgmember c ON a.Author= c.LoginID
        LEFT JOIN tblPartyForumUserInfo d ON d.loginid = c.loginid
        where a.ID='{0}' ", ForumID);

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
        }
        #endregion

        #region 获取论坛帖子回复信息
        public static DataSet GetPartyForumReplyInfo(string ForumID)
        {
            string sql = "";

            //    sql = string.Format(@"select (ROW_NUMBER() OVER(ORDER BY a.ReplyTime asc) + 1) AS RowNumber, a.*,b.UserName,b.BBSImage as ImageUrl  from tblPartyForumReply a    
            //left join tblPartyOrgMembers b on a.ReplyBy= b.LoginID 
            //where ForumID='{0}' order by a.ReplyTime asc", ForumID);
            sql = string.Format(@"select 0 as RowNumber, a.*,b.UserName,c.ImageID as ImageUrl  
                                        from tblPartyForumReply a    
                                        left join tblpartyorgmember b on a.ReplyBy= b.LoginID 
                                        LEFT JOIN tblPartyForumUserInfo c ON b.loginid = c.loginid
                                        where ForumID='{0}' order by a.ReplyTime asc", ForumID);

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
        }
        #endregion

        //        #region 获取子论坛分类列表信息
        //        public static DataSet GetPartyForumTypeList(string parent_type_id)
        //        {
        //            string sql = "";

        //            if (string.IsNullOrEmpty(parent_type_id))
        //            {
        //                parent_type_id = "A001";
        //            }

        //            sql = "select ID as [type_id], Title as [type_name] from tblPartyForumType where ParentID='" + parent_type_id + "'  order by OrderNO ";

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //public static DataSet GetPartyForumTypeBranchList(string branchID)
        //{
        //    using (SqlCommand cmd = new SqlCommand())
        //    {
        //        string str = string.Empty;
        //        str = string.Format(@"select PT.ID,PT.Title,PT.ImageUrl,PT.Description,ISNULL(PF.PostNum,0)PostNum,ISNULL(T1.ReplyNum,0)ReplyNum,
        //                                    ISNULL(T2.ToDayNum,0)ToDayNum,(ISNULL(PF.PostNum,0)+ISNULL(T1.ReplyNum,0))TotalNum,T3.ReplyTime,T3.UserName,T3.ForumID,
        //                                    (select top 1 ForumID from dbo.tblPartyForum where TypeID=PT.ID order by CreateTime desc)NewForumID,
        //                                    (select top 1 ForumTitle from dbo.tblPartyForum where TypeID=PT.ID order by CreateTime desc)NewForumTitle
        //                                    from tblPartyForumType PT
        //                                    left join 
        //	                                    (select TypeID,COUNT(1)as PostNum from dbo.tblPartyForum group by TypeID)PF
        //                                    on PT.ID=PF.TypeID
        //                                    left join
        //	                                    (select TypeID,COUNT(1)as ToDayNum from dbo.tblPartyForum 
        //	                                    where CONVERT(date,CreateTime,120)=CONVERT(date,GETDATE(),120) group by TypeID)T2
        //                                    on PT.ID=T2.TypeID
        //                                    left join
        //	                                    (select TypeID,COUNT(1)as ReplyNum from dbo.tblPartyForumReply rp
        //	                                    left join tblPartyForum pfm on rp.ForumID=pfm.ForumID group by TypeID)T1
        //                                    on PT.ID=T1.TypeID
        //                                    left join 
        //	                                    (select ForumID,TypeID,ReplyTime,UserName from dbo.tblPartyForum pf2
        //	                                    left join tblPartyOrgMembers on ReplyBy=LoginID
        //	                                    where not exists(select 1 from tblPartyForum 
        //		                                    where TypeID=pf2.TypeID and pf2.ReplyTime<ReplyTime)
        //		                                    and ReplyTime is not null
        //	                                    )T3
        //                                    on PT.ID=T3.TypeID
        //                                    where 1=1 and (PT.IsShowIndex=1 or PT.ID='{0}') and PT.ParentID='C001'  and PT.ID in 
        //(select BranchID from tblPartyOrgBranchSetting where IsBBS=1)  Order by ISNULL(PT.IsShowIndex,'0') desc, OrderNo", branchID);
        //        cmd.CommandText = str;
        //        return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //    }
        //}

        public static DataSet GetPartyForumTypeListEx(string parentID, string branchID)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                string str = string.Empty;
                str = @"CREATE TEMPORARY TABLE T1 SELECT *
        FROM (SELECT TypeID,COUNT(1)AS ReplyNum FROM tblPartyForumReply rp
        LEFT JOIN tblPartyForum pfm ON rp.ForumID=pfm.ID GROUP BY TypeID)TMP;
CREATE TEMPORARY TABLE T2 SELECT *
        FROM (SELECT TypeID,COUNT(1)AS ToDayNum FROM tblPartyForum 
        WHERE DATE_FORMAT(CreateTime,'%Y-%c-%d')=DATE_FORMAT(NOW(),'%Y-%c-%d') GROUP BY TypeID)TMP;
CREATE TEMPORARY TABLE PF SELECT *
        FROM (SELECT TypeID,COUNT(1)AS PostNum FROM tblPartyForum T1 GROUP BY TypeID)TMP;
        SELECT PT.ID,PT.Title,PT.ImageUrl,PT.Description,
        IFNULL(PF.PostNum,0)PostNum,IFNULL(T1.ReplyNum,0)ReplyNum,
        IFNULL(T2.ToDayNum,0)ToDayNum,
        (IFNULL(PF.PostNum,0)+IFNULL(T1.ReplyNum,0))TotalNum,
        (SELECT ID FROM tblPartyForum WHERE TypeID=PT.ID ORDER BY CreateTime DESC LIMIT 1)NewForumID,
        (SELECT ForumTitle FROM tblPartyForum WHERE TypeID=PT.ID ORDER BY CreateTime DESC LIMIT 1)NewForumTitle
        FROM tblPartyForumType PT
        LEFT JOIN PF ON PT.ID=PF.TypeID
        LEFT JOIN T2 ON PT.ID=T2.TypeID
        LEFT JOIN T1 ON PT.ID=T1.TypeID
        WHERE 1=1   ";
                //如果是支部论坛则显示当前用户组织对应的版块
                //if (PartyForumType.ZBForumID == parentID.Trim())
                if (parentID.Equals("C001"))
                {
                    return new DataSet();
                    //str += string.Format(@" and PT.ID in(select ID from dbo.tblPartyForumType FT
                    //                 left join tblPartyOrgBranchSetting BS on FT.ID=BS.BranchID
                    //                 where ISNULL(IsBBS,0)=1 and ID='{0}')", branchID);
                    //str += " Order by OrderNo";
                    //cmd.CommandText = str;
                    //cmd.Parameters.Add("@parentID", SqlDbType.NVarChar).Value = parentID;
                    //DataSet dsMain = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
                    //DataSet dsTemp = GetForumType();
                    //if (dsTemp.Tables[0].Rows.Count > 0)
                    //{
                    //    foreach (DataRow item in dsTemp.Tables[0].Rows)
                    //    {
                    //        DataRow dtMain = dsMain.Tables[0].NewRow();
                    //        DataRow dt = item;
                    //        for (int i = 0; i < dsTemp.Tables[0].Columns.Count; i++)
                    //        {
                    //            dtMain[i] = dt[i];
                    //        }
                    //        dsMain.Tables[0].Rows.Add(dtMain);
                    //    }
                    //}
                    //return dsMain;
                }
                else
                {
                    str += string.Format(@" and PT.ParentID='{0}'  and PT.IsShowIndex=1 
                                            Order by OrderNo;
                                            drop table T1;
                                            drop table T2;
                                            drop table PF;", parentID);
                    //cmd.CommandText = str;
                    //cmd.Parameters.Add("@parentID", SqlDbType.NVarChar).Value = parentID;
                    return ZHDJ.Data.MySqlHelper.ExecuteDataSet(str);
                }
            }
        }

        //        public static DataSet GetForumType()
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string str = string.Empty;
        //                str = @"select PT.ID,PT.Title,PT.ImageUrl,PT.Description,ISNULL(PF.PostNum,0)PostNum,ISNULL(T1.ReplyNum,0)ReplyNum,
        //ISNULL(T2.ToDayNum,0)ToDayNum,(ISNULL(PF.PostNum,0)+ISNULL(T1.ReplyNum,0))TotalNum,T3.ReplyTime,T3.UserName,T3.ForumID,
        //(select top 1 ForumID from dbo.tblPartyForum where TypeID=PT.ID order by CreateTime desc)NewForumID,
        //(select top 1 ForumTitle from dbo.tblPartyForum where TypeID=PT.ID order by CreateTime desc)NewForumTitle
        //from tblPartyForumType PT 
        //left join 
        //(select TypeID,COUNT(1)as PostNum from dbo.tblPartyForum group by TypeID)PF
        //on PT.ID=PF.TypeID
        //left join
        //(select TypeID,COUNT(1)as ToDayNum from dbo.tblPartyForum 
        //where CONVERT(date,CreateTime,120)=CONVERT(date,GETDATE(),120) group by TypeID)T2
        //on PT.ID=T2.TypeID
        //left join
        //(select TypeID,COUNT(1)as ReplyNum from dbo.tblPartyForumReply rp
        //left join tblPartyForum pfm on rp.ForumID=pfm.ForumID group by TypeID)T1
        //on PT.ID=T1.TypeID
        //left join 
        //(select ForumID,TypeID,ReplyTime,UserName from dbo.tblPartyForum pf2
        //left join tblPartyOrgMembers on ReplyBy=LoginID
        //where not exists(select 1 from tblPartyForum 
        //where TypeID=pf2.TypeID and pf2.ReplyTime<ReplyTime)
        //and ReplyTime is not null
        //)T3
        //on PT.ID=T3.TypeID
        //where 1=1
        // and PT.ParentID='C001' and ISNULL(PT.IsShowIndex,'0')=1 ";
        //                str += " Order by OrderNo";
        //                cmd.CommandText = str;
        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        #region 获取论坛帖子列表信息
        public static DataSet GetPartyForumList(string type, string keyword, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = @"a.ID as forum_id, a.ForumTitle as title, a.VisitTimes as views,
        (select COUNT(b.ReplyBy) from tblPartyForumReply b where b.ForumID=a.ID) as replys,
        a.CreateTime as publish_time, c.username as creater ";

            if (type == "1")
            {
                //                page_no = 1;
                //                page_count = 5;
                //                table = @"tblPartyForum a inner join tblPartyForumType  fy on a.TypeID=fy.ID
                //left join tblPartyOrgMembers c on a.Author = c.LoginID left join tblPartyOrgMembers d on a.ReplyBy = d.LoginID";
                //                where = "isnull(a.IsFocus,'0') = 1";
                //                orderBy = "IsFocusTime desc";

                string sql = @"select top 1 1 from tblPartyForum
        ;select top 9 a.ForumID as forum_id, a.ForumTitle as title, a.VisitTimes as [views],
        (select COUNT(b.ReplyBy) from tblPartyForumReply b where b.ForumID=a.ForumID) as replys,
        a.CreateTime as publish_time, c.username as creater from tblPartyForum a inner join tblPartyForumType  fy on a.TypeID=fy.ID
        left join tblPartyOrgMembers c on a.Author = c.LoginID left join tblPartyOrgMembers d on a.ReplyBy = d.LoginID
        where isnull(a.IsFocus,'0') <>0
        order by a.IsFocus desc, a.IsFocusTime desc";
                return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
            }
            else if (type == "2")
            {
                table = @"(select top 5 ForumID,COUNT(*) num from tblPartyForumBrowse where BrowseTime between (CONVERT(varchar(11),dateadd(day,-7,GETDATE()),120)+' 00:00:00') 
        and (CONVERT(varchar(11),GETDATE(),120)+' 23:59:59')
        group by ForumID order by num desc) aa left join tblPartyForum a on aa.ForumID=a.ForumID
        left join tblPartyOrgMembers c on a.Author = c.LoginID left join tblPartyOrgMembers d on a.ReplyBy = d.LoginID";
                where = "1=1 and a.ForumID!='' and a.ForumID is not null ";
                orderBy = "aa.num desc";
            }
            else
            {
                table = @"tblPartyForum a left join tblpartyorgmember c on a.Author = c.LoginID left join tblpartyorgmember d on a.ReplyBy = d.LoginID";
                where = " a.TypeID='" + type + "' ";
                orderBy = "a.IsFirst desc,a.CreateTime desc";
            }

            if (!string.IsNullOrEmpty(keyword))
                where += string.Format(" and (d.UserName like '%{0}%' or c.UserName like '%{0}%' or a.ForumTitle like '%{0}%') ", keyword);


            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        #region 修改阅读次数(页面已修改，暂时不用 x)
        public static bool UpdatePartyForumVisitTimes(string forumID)
        {
            string sql = string.Format(@"update tblPartyForum set VisitTimes =VisitTimes+1 where ID='{0}'", forumID);

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 回帖
        public static bool ReplyPartyForum(string forumID, string userID, string content)
        {
            var replyID = ZHDJ.Core.Util.StringHelper.NewID;
            string sql = string.Format(@"insert into tblPartyForumReply(ID, ForumID, ReplyContent, ReplyBy, ReplyTime,Source)
        values('{3}','{0}','{2}','{1}',now(), 2);
        update tblPartyForum set ReplyBy='{1}',ReplyTime=now() where ID = '{0}';", forumID, userID, content, replyID);
             
            ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql);

            //增加积分
            PartyScoreHelper.Add(() => PartyScoreHelper.AddForum(SysEnum.ForumScoreType.Reply, userID, userID, forumID, replyID));
            //AddScore(EnumScoreType.Reply, userID, forumID, "回复帖子", replyID);
            return true;
        }
        #endregion

        #region 发帖
        public static bool PublishPartyForum(string ForumTitle, string ForumContent, string Author, string TypeID)
        {
            string id = StringHelper.NewID;
            string sql = string.Format(@"insert into tblPartyForum(ID, ForumCategory, ForumTitle, ForumContent, VisitTimes, 
        Author, CreateTime, ModifyTime, ReplyTime, 
        IsFirst, IsFirstTime, IsEssence, IsEssenceTime, TypeID, ReplyBy,Source)
        values('{4}','','{0}','{1}',0,
        '{2}',now(),now(),now(),
        0,null,null,null,'{3}',null, '2') ", ForumTitle, ForumContent, Author, TypeID, id);

            ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql);

            //增加积分 
            PartyScoreHelper.Add(() => PartyScoreHelper.AddForum(SysEnum.ForumScoreType.New, Author, Author, id));
            //AddScore(InterfaceHelper.EnumScoreType.Forum, Author, id, "发帖子", "");

            return true;
        }

        /// <summary>
        /// 能否再发帖
        /// </summary>
        /// <returns></returns>
        public static bool CanPostForum(string loginID, DateTime dt, string forumCategory = "")
        {
            if (dt == null)
            {
                dt = DateTime.Now.AddMinutes(-15);
            }
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandText = string.Format(@"SELECT count(1) FROM tblPartyForum pf
                                            where Author='{0}'  and  CreateTime > '{1}' ", loginID, dt.ToString("yyyy-MM-dd HH:mm:ss"));
                //cmd.Parameters.Add("@loginID", SqlDbType.VarChar).Value = loginID;
                //cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime).Value = dt;
                if (!string.IsNullOrEmpty(forumCategory))
                {
                    cmd.CommandText += " and ForumCategory='"+ forumCategory + "' ";
                    //cmd.Parameters.Add("@ForumCategory", SqlDbType.VarChar).Value = forumCategory;
                }
                object obj = ZHDJ.Data.MySqlHelper.ExecuteScalar(cmd.CommandText);
                if (obj != null)
                {
                    return Convert.ToInt32(obj) < 1;
                }
                else
                {
                    return false;
                }
            }
        }
        #endregion
        //        #endregion

        //        #region 考试
        //#region 返回当天能否答题
        ///// <summary>
        /////  返回当天能否答题
        ///// </summary>
        ///// <param name="user"></param>
        ///// <returns></returns>
        //public static bool IsAbleExamination(string user)
        //{
        //    using (SqlCommand cmd = new SqlCommand())
        //    {
        //        StringBuilder sbSql = new StringBuilder();
        //        sbSql.AppendFormat(@"select Count(*) from tblPartySpecialSubimt where SubimtAuthor='{0}' and IsAnswerAll='1' and Convert(varchar,SubimtTime,23)=Convert(varchar,getdate(),23)", user);
        //        cmd.CommandText = sbSql.ToString();
        //        return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd)) < 2 ? true : false;
        //    }
        //}
        //#endregion

        #region 验证答题是否正确
        public static bool TopicOptionIsRight(string TopicID, string[] optionList)
        {
            optionList = optionList.Where(a => a.Trim() != "").ToArray();
            //from item in optionList where item.Trim() != "" select item;
            bool flag = true;
            string sql = string.Format(@"select * from tblPartyEduSubjectOptions where subjectid='{0}' and IsAnswer='1'", TopicID);
            DataSet ds = ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql);
            if (ds == null || ds.Tables[0].Rows.Count == 0 || optionList.Length != ds.Tables[0].Rows.Count)
                return false;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                flag = false;
                foreach (string item in optionList)
                {
                    if (ds.Tables[0].Rows[i]["ID"].ToString() == item)
                    {
                        flag = true;
                        break;
                    }
                }

                if (!flag)
                    return false;
            }

            return true;
        }
        #endregion

        //        #region 获取考试题目
        public static DataSet GetExamin(string userID)
        {
            return GetExamin(userID, "");
        }

        public static DataSet GetExamin(string userID, string specialID)
        {
            string sql = @"CREATE TEMPORARY TABLE tempT select ID,Subjectcontent,SpecialID,SubjectType from tblPartyEduSubject d
                            where d.Enabled=1  and d.SpecialID =(select id from tblPartyEduSpecial Es where Es.SpecialFlag=?SpecialFlag LIMIT 1 )
                            ORDER BY  RAND() LIMIT 3;
                            SELECT ID AS TopicID, Subjectcontent AS TopicContent,0 AS OrderNo FROM tempT;
                            SELECT ID AS optionid,OptionsContent AS optioncontent,IsAnswer,SubjectID FROM tblPartyEduSubjectOptions s
                            where EXISTS (select ID from tempT where tempT.ID=s.SubjectID ) order by SubjectID,Orderno;

                            drop table tempT;";
            MySqlParameter[] para = new MySqlParameter[] {
                new MySqlParameter() {
                DbType =DbType.String, ParameterName= "SpecialFlag",Value= specialID }
            };
            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql, para);
            //if (!string.IsNullOrEmpty(specialID))
            //{
            //    specialID = "SpecialID = '" + specialID + "' and ";
            //}
            //else
            //{
            //    specialID = " isnull(SpecialID,'')=''  and  ";
            //}
            //using (SqlCommand cmd = new SqlCommand())
            //{
            //    StringBuilder sbSql = new StringBuilder();
            //    sbSql.AppendFormat(@"select Top 3 TopicID,TopicContent,SpecialID,OrderNo into #t1 from [tblPartyTopicInfo] where {1}  TopicState !='0' order by newid()
            //                                declare @coun int
            //                                set @coun = (select Count(*) from #t1)
            //                                if(@coun <3)
            //                                begin 
            //                                delete from tblPartyTestRecord where Author='{0}'
            //                                select Top 3 TopicID,TopicContent,SpecialID,OrderNo from [tblPartyTopicInfo] where {1} TopicState !='0' order by newid()
            //                                end
            //                                else
            //                                begin
            //                                select * from #t1
            //                                end
            //                                drop table #t1", userID, specialID);
            //    cmd.CommandText = sbSql.ToString();
            //    return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sbSql.ToString());
            //}
        }

        /// <summary>
        /// 在线学习测试专题列表
        /// </summary>
        /// <returns></returns>
        public static DataSet GetExaminSpecialList(string SpecialID)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"SELECT SpecialFlag AS SpecialID,SpecialName,StudyDescription as SpeciaDescription FROM tblPartyEduSpecial a  WHERE  a.Enabled=1 ");
                if (!string.IsNullOrEmpty(SpecialID))
                {
                    sbSql.Append("  and SpecialFlag='" + SpecialID + "'");
                    //cmd.Parameters.Add("@SpecialID", SqlDbType.VarChar).Value = SpecialID;
                }
                cmd.CommandText = sbSql.ToString();
                return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sbSql.ToString());
            }
        }
        //        #endregion

        //        #region 返回问卷单个题目的所有选项
        //        ///<summary>
        //        /// 返回问卷单个题目的所有选项
        //        /// </summary>
        //        public static DataSet GetOption(string topicid)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.AppendFormat(@"select optionid,optioncontent from tblPartyTopicOption where TopicID='{0}' order by OrderNo ", topicid);
        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 返回调查问卷单个题目的所有选项
        //        ///<summary>
        //        /// 返回问卷单个题目的所有选项
        //        /// </summary>
        //        public static DataSet GetQuestionNaireOption(string topicid)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.AppendFormat(@"select OptionID,OptionContent from tblPartyQTopicOption where TopicID = '{0}' order by OrderNo", topicid);
        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        #region 返回问卷单个题目的所有正确选项
        ///<summary>
        /// 返回问卷单个题目的所有正确选项
        /// </summary>
        public static DataSet GetRightOption(string topicid)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"select ID as optionid,optionscontent as optioncontent from tblPartyEduSubjectOptions where subjectid='{0}' and IsAnswer='1'  order by OrderNo ", topicid);
                cmd.CommandText = sbSql.ToString();
                return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sbSql.ToString());
            }
        }
        #endregion

        //        #region 提交考试
        public static bool ExaminTopicSubimt(string recordID, bool isAllRight, string specialID, string userID, List<bool> examIsRigthList, List<Answer> exam)
        {
            string sql = "";
             
            sql += string.Format(@" insert into tblPartyEduTestRecord(ID, SpecialId, SubimtAuthor, SubmitTime, IsAnswerAll)
         values('{0}', '{1}', '{2}', now(), {3}); ", recordID, specialID, userID, (isAllRight ? 1 : 0));

            for(int i = 0; i < exam.Count; i++)
            { 
                string[] options = exam[i].option_id.Split(',');

                for(int m = 0; m < options.Length; m++)
                {
                    sql += string.Format(@"INSERT INTO tblpartyedutestrecorddetail(ID, RecordId, SubjectID, OptionID, IsRight)
                    VALUES('{0}', '{1}', '{2}', '{3}', '{4}');", StringHelper.NewID, recordID, exam[i].exam_id, options[m], (examIsRigthList[i] ? 1 : 0));
                }
            } 

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }

        //        /// <summary>
        //        /// 
        //        /// </summary>
        //        /// <returns></returns>
        //        public static Double DayIntegral(string loginid, string specialID)
        //        { 

        //            var item = Convert.ToString(GetIntegralEx(loginid, specialID));
        //            return Convert.ToDouble(item) * Convert.ToDouble(EveryScore);


        //        }

        //        /// <summary>
        //        /// 每次得分
        //        /// </summary>
        //         public static Double EveryScore
        //         {
        //             get
        //             {
        //                 if (SXT.Party.Utility.PartyScore.NewPartyScoreIsEnabled())
        //                 {
        //                     var score = SXT.Party.Utility.PartyScore.GetEveryScoreFormSetting(PartyEnums.PartyScoreSettingSystemCategory.PartyOnlineTest);
        //                     return Convert.ToDouble(score);
        //                 }
        //                 else
        //                     return 0.5;
        //             }
        //         }
        //        /// <summary>
        //        /// 一天分数上限
        //        /// </summary>
        //         public static Double EveryDayScore
        //         {
        //             get
        //             {
        //                 if (SXT.Party.Utility.PartyScore.NewPartyScoreIsEnabled())
        //                 {

        //                     return 3;
        //                 }
        //                 else
        //                     return 1;
        //             }
        //         }

        //         /// <summary>
        //         /// 返回当天积分
        //         /// </summary>
        //         public static double GetIntegralEx(string loginid, string SpecialID)
        //         {
        //             using (SqlCommand cmd = new SqlCommand())
        //             {
        //                 StringBuilder sbSql = new StringBuilder();
        //                 sbSql.AppendFormat(@"select  Count(*) as integral  from [dbo].[tblPartySpecialSubimt]
        // where 
        //                                    Convert(varchar,SubimtTime,23)=Convert(varchar,GETDATE(),23) 
        //                                    and IsAnswerAll='1' and SpecialID=@SpecialID and SubimtAuthor=@SubimtAuthor");
        //                 cmd.Parameters.Add("@SubimtAuthor", SqlDbType.VarChar).Value = loginid;
        //                 cmd.Parameters.Add("@SpecialID", SqlDbType.VarChar).Value = SpecialID ?? "";
        //                 cmd.CommandText = sbSql.ToString();
        //                 return Convert.ToDouble(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd));
        //             }
        //         }


        /// <summary>
        /// 获取专题ID
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static Dictionary<string, string> GetSpecialID()
        {
            Dictionary<string, string> Item = new Dictionary<string, string>();
            Item.Add("nullTest", "nullTest");
            using (SqlCommand cmd = new SqlCommand())
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"SELECT SpecialFlag AS SpecialID,SpecialName FROM tblPartyEduSpecial WHERE Enabled=1");

                cmd.CommandText = sbSql.ToString();
                var ds = ZHDJ.Data.MySqlHelper.ExecuteDataSet(sbSql.ToString());
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    Item.Add(Convert.ToString(item["SpecialID"]), Convert.ToString(item["SpecialName"]));
                }
                return Item;
            }
        }

        //        #endregion

        //        #region 提交调查问卷
        //        public static bool QuestionNaireTopicSubimt(string id, string Survey_id, string tids, string[] oids)
        //        {
        //            string sql = "";
        //            sql += string.Format(@"insert into tblPartyQSpecialSubimt(SubimtID, SpecialID, SubimtAuthor, SubimtTime)
        //values('{0}', '{1}', '手机用户', getdate());", id, Survey_id);
        //            foreach (string item in oids)
        //            {
        //                string Tid = Convert.ToString(GetTopicID(item).Rows[0]["TopicID"]);
        //                sql += string.Format(@"insert into tblPartyQSubimtAnswer(SubimtID, TopicID, OptionID)
        //values('{0}', '{1}', '{2}');", id, Tid, item);
        //            }

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }

        //        public static DataTable GetTopicID(string optionID)
        //        {
        //            string sql = string.Format(" select TopicID from dbo.tblPartyQTopicOption where OptionID='{0}'", optionID);
        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql).Tables[0];
        //        }
        //        #endregion
        //        #endregion

        //        #region 机关民主评议

        //        #region
        //        /// <summary>
        //        ///  获取机关民主评议
        //        /// </summary> 
        //        /// <param name="activityID"></param>
        //        /// <returns></returns>
        //        public static DataSet GetVoteActivityByID()
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();

        //                string where = "";
        //                where = " where a.ActivitySign in (select ParaMember from  tblSysSystemParameter where paratype='SXT.Mobile.VotePara')";

        //                sbSql.AppendFormat(@"select a.ActivityID,a.ActivityName, MIN(b.BeginTime) as BeginTime,
        //max(b.EndTime) as EndTime,a.VoteType,a.VoteUserType,a.ActivityDescribe
        //from tblVoteActivity a
        //left join tblVoteLevel b on a.ActivityID = b.ActivityID {0} 
        //group by a.ActivityID,a.ActivityName,a.VoteType,a.VoteUserType,a.ActivityDescribe  ", where);

        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }

        //        /// <summary>
        //        /// 获取被评议对象列表
        //        /// </summary>
        //        /// <param name="user"></param>
        //        /// <param name="activityID"></param>
        //        /// <returns></returns>
        //        /// <param name="ItemGroup">机关分组</param>
        //        public static DataSet GetVoteItemByID(string user, string activityID, string ItemGroup = "")
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.AppendFormat(@"select a.ItemID, a.Title, c.BranchName, (case isnull(b.RecordID,'') when '' then '0' else '1' end) as VoteState,
        //d.ParaMemberName as VoteResult, b.Content as VoteDesc
        //from tblVoteItem a 
        //left join tblVoteRecord b on a.ItemID=b.ItemID and b.VoteUser='{1}'
        //left join tblPartyOrgBranch c on a.BranchID=c.BranchID
        //left join  tblSysSystemParameter d on b.VoteScore=d.ParaMember and d.paratype='SXT.Vote.ScoreType'
        // where a.ActivityID='{0}' and a.Enabled='1'
        // ", activityID, user);
        //                if (!string.IsNullOrEmpty(ItemGroup))
        //                {
        //                    sbSql.Append(@" and a.ItemGroup=@ItemGroup");
        //                    cmd.Parameters.Add("@ItemGroup", SqlDbType.VarChar).Value = ItemGroup;
        //                }
        //                sbSql.Append(" order by a.OrderNo");
        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }

        //        public static DataSet GetVoteAndItemByID(string ItemID, string VoteUser)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.AppendFormat(@"select a.*,c.LevelID,c.BeginTime,c.EndTime,d.RecordID from tblVoteActivity a
        //inner join tblVoteItem b on a.ActivityID=b.ActivityID and b.Enabled='1'
        //left join tblVoteLevel c on a.ActivityID=c.ActivityID
        //left join tblVoteRecord d on b.ItemID=d.ItemID and d.VoteUser='{1}'
        //where a.ActivitySign in (select ParaMember from  tblSysSystemParameter where paratype='SXT.Mobile.VotePara') and b.ItemID='{0}'", ItemID, VoteUser);

        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }

        //        public static bool IsHaveVote(string VoteUser, string ActivityID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.AppendFormat(@" select * from tblVoteRecord a
        // inner join tblVoteItem b on a.ItemID = b.ItemID 
        // where a.VoteUser = '{0}' and b.ActivityID='{1}'", VoteUser, ActivityID);

        //                cmd.CommandText = sbSql.ToString();
        //                DataSet ds = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);

        //                if (ds == null || ds.Tables[0].Rows.Count == 0)
        //                    return false;
        //                else
        //                    return true;
        //            }
        //        }

        //        public static bool VoteActivitySubmit(string LevelID, string ItemID, string VoteUser, string VoteScore, string Content)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.AppendFormat(@" insert into tblVoteRecord(RecordID,LevelID,ItemID,IsCurrentBranch,VoteUser,VoteTime,VoteScore,Content)
        //values(REPLACE(NEWID(), '-', '') , '{0}','{1}', '0', '{2}', GETDATE(), '{3}', '{4}')", LevelID, ItemID, VoteUser, VoteScore, Content);

        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }

        //        public static DataSet GetVoteItemByPage(string userID, string ActivityID, string VoteState, string key, int page_no, int page_count, string ItemGroup = "")
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = " 1=1 ";
        //            string orderBy = string.Empty;

        //            field = @" a.ItemID, a.Title, c.BranchName, (case isnull(b.RecordID,'') when '' then '0' else '1' end) as VoteState,
        //d.ParaMember as VoteResult, b.Content as VoteDesc ";
        //            table = string.Format(@" tblVoteItem a 
        //left join tblVoteRecord b on a.ItemID=b.ItemID and b.VoteUser='{0}'
        //left join tblPartyOrgBranch c on a.BranchID=c.BranchID
        //left join  tblSysSystemParameter d on b.VoteScore=d.ParaMember and d.paratype='SXT.Vote.ScoreType'", userID);
        //            where += " and a.ActivityID='" + ActivityID + "' and a.Enabled='1'";

        //            if (!string.IsNullOrEmpty(key))
        //            {
        //                where += string.Format(" and (a.Title like '%{0}%' or c.BranchName like '%{0}%'  or b.Content like '%{0}%') ", key);
        //            }
        //            if (!string.IsNullOrEmpty(ItemGroup))
        //            {
        //                where += " and a.ItemGroup='" + ItemGroup + "'";
        //            }
        //            if (VoteState == "1")
        //                where += " and isnull(b.RecordID,'') = '' ";
        //            else if (VoteState == "2")
        //                where += " and isnull(b.RecordID,'') != '' ";

        //            orderBy = "a.OrderNo";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }

        //        public static DataSet GetVoteItemConentOrDesc(string infoID, string infoType)
        //        {
        //            string sql = "";
        //            if (infoType == "0")
        //            {
        //                sql = string.Format(@"select Title as infoTitle, ItemDescribe as content, CreateTime as infoTime, '' as UserName from tblVoteItem where ItemID='{0}'", infoID);
        //            }
        //            else if (infoType == "1")
        //            {
        //                sql = string.Format(@"select Title as infoTitle, ItemConent as content, CreateTime as infoTime, '' as UserName from tblVoteItem where ItemID='{0}'", infoID);
        //            }
        //            else
        //            {
        //                return null;
        //            }

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion
        //        #endregion

        //        #region 其他
        //        #region 意见反馈接口
        //        public static bool ViewManageForum(string ViewType, string UserID, string connet, string contact)
        //        {
        //            string sql = string.Format(@"insert into tblMSViewManage(ID,ViewType, UserID,connet,contact,Create_time)
        //values(REPLACE(NEWID(), '-' ,''), '{0}', '{1}' ,'{2}', '{3}', GETDATE())", ViewType, UserID, connet, contact);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        #region 检测客户端版本信息
        public static DataSet GetLastVersionInfo(string system_type)
        {
            string sql = string.Format(@"select Version_no as version,download_url,content 
        from tblpartymobileversionmanage where Status = '3' and system_type='{0}' order by Create_time desc limit 0, 1", system_type);

            return ZHDJ.Data.MySqlHelper.ExecuteDataSet(sql); 
        }
        #endregion

        #region 客户端装机设备日志记录接口
        public static bool ClientInstallLog(string system_type, string Device_number, string os_version, string Client_version)
        {
            string sql = string.Format(@"insert into tblMSPCInstallRecord(Id,system_type,Device_number,os_version,Client_version,Create_time)
        values('{4}', '{0}', '{1}', '{2}', '{3}', '{5}')", system_type, Device_number, os_version, Client_version, StringHelper.NewID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 客户端登录信息日志记录接口
        public static bool ClientPCLoginLog(string UserID, string Device_number, string app_version, string system_type)
        {
            string sql = string.Format(@"insert into tblMSPCLoginRecord(id, UserID, Device_number, app_version, system_type, Login_time)
        values('{4}', '{0}', '{1}', '{2}', '{3}', '{5}')", UserID, Device_number, app_version, system_type, StringHelper.NewID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 客户端模块访问日志记录接口
        public static bool ClientPCItemAccessLog(string system_type, string device_id, string app_version, string UserID, string Access_Item)
        {
            string sql = string.Format(@"insert into tblMSPCAccessItem(id, system_type, device_id, app_version, UserID, Access_Item, Access_time)
        values('{5}', '{0}', '{1}', '{2}', '{3}', '{4}', '{6}')", system_type, device_id, app_version, UserID, Access_Item, StringHelper.NewID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            return ZHDJ.Data.MySqlHelper.ExecuteNonQuery(sql) > 0;
        }
        #endregion

        #region 获取党情速递信息列表
        /// <returns></returns>
        public static DataSet GetPartysituationCourierList(string type, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = @"article.ID as file_id,article.Title as name, '' as type, partyfile.Size,  partyfile.url  ";
            table = @"tblpartyarticle article LEFT JOIN tblpartyfile partyfile ON article.ImageID=partyfile.ID";
            where = " 1=1 and article.category = 'PolicyFile' ";
            orderBy = "article.createtime desc";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        //        #region 获取党政策文件列表
        //        /// <returns></returns>
        //        public static DataSet GetPartyJBPolicyDocumentList(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"a.ID as [file_id],a.Title as name, '' as [type], '' as Size,b.StoragePath as url   ";
        //            table = @"tblPartyJBPolicyDocument a left join tblFiles b on a.fileid = b.FileID";
        //            where = " 1=1 ";
        //            orderBy = "a.createtime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        #region 获取党务公文模板信息列表
        /// <returns></returns>
        public static DataSet GetPartyOfficialDocumentList(int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            field = @"article.ID as file_id,article.Title as name, '' as type, partyfile.Size,  article.ImageID as url  ";
            table = @"tblpartyarticle article LEFT JOIN tblpartyfile partyfile ON article.ImageID=partyfile.ID";
            where = " 1=1 and article.category = 'Document' ";
            orderBy = "article.createtime desc";

            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        }
        #endregion

        //        #region 获取与该圈子相关的有效广告列表，最多返回5条
        //        public static DataSet GetCircleAdvertList(string type)
        //        {
        //            string sql = @"select top 5 * from tblMSCircleAdvert where [status] = '2' and GETDATE()>=up_time and GETDATE()<=(down_time + ' 23:59:59') {0} 
        //order by up_time";

        //            if (type == "0")
        //                sql = string.Format(sql, " and circleType in('2','0')  ");
        //            else if (type == "1")
        //                sql = string.Format(sql, " and circleType in('2','1')  ");
        //            else
        //                sql = string.Format(sql, "");

        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 获取广告的详细内容
        //        public static DataSet GetCircleAdvertDetail(string id)
        //        {
        //            string sql = @"select * from tblMSCircleAdvert where ID ='" + id + "'";
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 智能报表
        //        /// <summary>
        //        /// 
        //        /// </summary>
        //        /// <param name="branchID"></param>
        //        /// <returns></returns>
        //        public static DataSet QueryMemberStructureAnalyse(string branchID, string branchType)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"EXEC dbo.sp_MemberStructureAnalyse @BranchID, @BranchType";
        //                cmd.Parameters.Add("@BranchID", SqlDbType.VarChar).Value = branchID;
        //                cmd.Parameters.Add("@BranchType", SqlDbType.VarChar).Value = branchType;
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion

        //        #region 群众留言列表接口
        //        public static DataSet GetMediaNewsList(string key, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = @"MessageID as MessageID,Title, (CASE [States] WHEN 1 THEN '已回复' ELSE '待回复' END) AS States, CreateTime, 
        //UserName as CreaterName, ModifyTime as ReplyerTime  ";
        //            table = @"tblPartyMassLineSuggest";
        //            where = " ShowInHomePage=1 and Title like '%" + key + "%' ";
        //            orderBy = "CreateTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 群众留言列表接口
        //        public static DataSet GetMediaNewsDetail(string messageID)
        //        {
        //            string sql = string.Format(@"select a.Title,a.Content, a.UserName as username, a.CreateTime, a.ContactWay as phone,a.Address, a.reply as ReplyContent,
        // a.ModifyTime as ReplyerTime, b.USername as ReplyUser  
        //from tblPartyMassLineSuggest a left join tblPartyOrgMembers b on a.ModifyBY=b.loginID where MessageID='{0}'", messageID);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 群众留言提交接口
        //        public static DataSet SubmitMediaNews(string userID, string Title, string phone, string Content, string Address)
        //        {
        //            string messageID = StringHelper.NewID;
        //            string sql = string.Format(@"insert into tblPartyMassLineSuggest(MessageID,Title,LoginID,UserName,BranchID,Content,
        //ContactWay,Address,States,Reply,CreateTime,ModifyBy,ShowInHomePage)
        //select top 1 '{5}','{0}','{1}',UserName,'','{2}',
        //'{3}','{4}','0','',GETDATE(),'','0'
        //from tblPartyOrgMembers where LoginID= '{1}'", Title, userID, Content, phone, Address, messageID);

        //            var tempRelationid = StringHelper.NewID;
        //            AddTask(tempRelationid, Title, "群众路线-留言建议",
        //               userID, new string[] { QueryTopBranchID() }
        //               , "../../../PartyAdmin/Module/MassLine/SuggestAudit.aspx?RelationID=" + tempRelationid + "&MessageID=" + messageID
        //               , "Branch", "下级组织");

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //        /// <summary>
        //        /// 查询最顶层组织ID
        //        /// </summary>
        //        /// <returns></returns>
        //        public static string QueryTopBranchID()
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"SELECT BranchID FROM dbo.tblPartyOrgBranch WHERE ISNULL(ParentBranchID, '') = ''";
        //                Object obj = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);
        //                if (obj != null) return obj.ToString();
        //                else return "";
        //            }
        //        }
        //        #endregion

        //        #region 提交群众意见接口
        //        public static string GetToDepartmentID(string departmentName)
        //        {
        //            string sql = string.Format(@"select BranchID from tblPartyDanWei where BranchName ='{0}' or DanWei='{0}' or BranchID='{0}' ", departmentName);

        //            object obj = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(sql);

        //            if (obj == null)
        //            { return ""; }
        //            else
        //            { return obj.ToString(); }
        //        }

        //        public static DataSet GetPartyDanWeiList(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = string.Format(@" * ");
        //            table = " tblPartyDanWei ";
        //            where = " 1=1  ";
        //            orderBy = " BranchID ";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }


        //        public static bool InsertPartyFeedback(SubmitFeedbackInParam param)
        //        {
        //            string id = Guid.NewGuid().ToString("N");
        //            string sql = string.Format(@"insert into tblPartyFeedback(ID,Name,Telephone,BranchID,CreateBy,CreateTime,OrderNo,Anonymous)
        //                                            select '{0}', '{1}','{2}','{3}','{4}',GETDATE(),MAX(OrderNo)+1,'{5}' from tblPartyFeedback;
        //                                       insert into tblPartyFeedbackOption(CID,PID,Type,TypeOption,Opinion,Example,OrderNo,CreateBy,CreateTime)
        //                                            values(replace(newid(), '-', ''), '{0}','{6}', '{7}','{8}','',1,'{4}',GETDATE())",
        //                                       id, param.Name, param.Mobile, param.DepartmentID, param.User_ID, param.Sign_mode,
        //                                       param.Sort_1Desc, param.Sort_2Desc, param.Message_Content);
        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion

        //        #region 组织ID接口
        //        /// <summary>
        //        /// 获取所有组织
        //        /// </summary>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <param name="BranchID"></param>
        //        /// <param name="BranchName"></param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyBranchList(int page_no, int page_count, string BranchID, string BranchName)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;


        //            field = string.Format(@" * ");
        //            table = " tblPartyOrgBranch ";
        //            where += " 1=1";
        //            if (!string.IsNullOrEmpty(BranchID))
        //            {
        //                where += " and BranchID='" + BranchID + "'";
        //            }
        //            if (!string.IsNullOrEmpty(BranchName))
        //            {
        //                where += " and BranchName like '%" + BranchID + "%' ";
        //            }
        //            //where = " 1=1 and BranchID like '%" + BranchID + "%' and BranchName like '%" + BranchName + "%' ";
        //            orderBy = " BranchID ";
        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }

        //        /// <summary>
        //        /// 获取组织架构
        //        /// </summary>
        //        /// <param name="BranchID"></param>
        //        /// <param name="BranchName"></param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyBranchListPiker(string BranchID, string BranchName)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@" select b.BranchID,b.OrderNo,b.BranchName,  '_root_'  AS ParentBranchID
        //                                from tblPartyOrgBranch b where BranchID in (select id from f_BranchID(@BranchID)) ");
        //                if (!string.IsNullOrEmpty(BranchName))
        //                {
        //                    sbsql.Append(" and BranchName like @BranchName");
        //                    cmd.Parameters.Add("@BranchName", SqlDbType.NVarChar).Value = BranchName;
        //                }
        //                if (string.IsNullOrEmpty(BranchID))
        //                {
        //                    cmd.Parameters.Add("@BranchID", SqlDbType.NVarChar).Value = "D658070EC3BF425BA8417745FDCBFCB0";
        //                }
        //                else
        //                {
        //                    cmd.Parameters.Add("@BranchID", SqlDbType.NVarChar).Value = BranchID;
        //                }
        //                cmd.CommandText = sbsql.ToString();
        //                DataSet ds = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //                return ds;
        //            }
        //        }
        //        #endregion

        #region 群众路线资讯列表接口
        /// <summary>
        /// 群众路线资讯列表接口
        /// </summary>
        /// <param name="type">1：民情日记、2：学习心得、3：先进典型、4：活动简报、5：整改方案、6：建章立制</param>
        /// <param name="page_no">当前页</param>
        /// <param name="page_count">每页记录数</param>
        /// <returns></returns>
        public static DataSet GetMassLineInfoList(string type, int page_no, int page_count)
        {
            string field = string.Empty;
            string table = string.Empty;
            string where = string.Empty;
            string orderBy = string.Empty;

            switch (type)
            {
                case "1":
                    field = string.Format(@"a.ID AS msg_id, a.title, a.ImageID AS image_url, a.CreateTime AS publish_time, 
                                            a.CreateTime AS push_time, b.BranchName AS source, '0' AS Scan_times ");
                    table = "tblpartyarticle a LEFT JOIN tblpartyorgbranch b ON a.BranchID = b.BranchID";
                    where = "a.category='mqrj' AND a.Module = 'MassLine' AND a.Status=4  ";
                    orderBy = "a.flags DESC,a.createTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "2":
                    field = string.Format(@"a.ID AS msg_id, a.title, a.ImageID AS image_url, a.CreateTime AS publish_time, 
                                            a.CreateTime AS push_time, b.BranchName AS source, '0' AS Scan_times ");
                    table = "tblpartyarticle a LEFT JOIN tblpartyorgbranch b ON a.BranchID = b.BranchID";
                    where = "a.category='xxxd' AND a.Module = 'MassLine' AND a.Status=4  ";
                    orderBy = "a.flags DESC,a.createTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "3":
                    field = string.Format(@"a.ID AS msg_id, a.title, a.ImageID AS image_url, a.CreateTime AS publish_time, 
                                            a.CreateTime AS push_time, b.BranchName AS source, '0' AS Scan_times ");
                    table = "tblpartyarticle a LEFT JOIN tblpartyorgbranch b ON a.BranchID = b.BranchID";
                    where = "a.category='MassHonour' AND a.Module = 'MassLine' AND a.Status=4  ";
                    orderBy = "a.flags DESC,a.createTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "4":
                    field = string.Format(@"a.ID AS msg_id, a.title, a.ImageID AS image_url, a.CreateTime AS publish_time, 
                                            a.CreateTime AS push_time, b.BranchName AS source, '0' AS Scan_times ");
                    table = "tblpartyarticle a LEFT JOIN tblpartyorgbranch b ON a.BranchID = b.BranchID";
                    where = "a.category='ActivityBulletin' AND a.Module = 'MassLine' AND a.Status=4  ";
                    orderBy = "a.flags DESC,a.createTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "5":
                    field = string.Format(@"a.ID AS msg_id, a.title, a.ImageUrl AS image_url, a.CreateTime AS publish_time, 
                                            a.CreateTime AS push_time, b.BranchName AS source, '0' AS Scan_times ");
                    table = "tblpartybranchdraft a LEFT JOIN tblpartyorgbranch b ON a.BranchID = b.BranchID ";
                    where = @"a.category='givenreformplan' AND a.Status=1 ";
                    orderBy = "a.createTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                case "6":
                    field = string.Format(@"a.ID AS msg_id, a.title, a.ImageUrl AS image_url, a.CreateTime AS publish_time, 
                                            a.CreateTime AS push_time, b.BranchName AS source, '0' AS Scan_times ");
                    table = "tblpartybranchdraft a LEFT JOIN tblpartyorgbranch b ON a.BranchID = b.BranchID ";
                    where = @"a.category='systembuildplan' AND a.Status=1 ";
                    orderBy = "a.createTime DESC";

                    return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
                default:
                    return new DataSet();
            }
        }
        #endregion

        //        #region 民意调查类表接口
        //        /// <summary>
        //        /// 民意调查类表接口
        //        /// </summary>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录数</param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyQuestionNaireList(int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = string.Format(@" a.SpecialID as 'Survey_id',  SpecialName as 'title', '' as image_url,SpeciaDescription as 'Survey_depict', StartTime as 'start_time', EndTime as 'stop_time','0' as 'Survey_stuts' ");
        //            table = " tblPartyQSpecial a ";
        //            where = " a.Status = 1  ";
        //            orderBy = "a.StartTime desc,a.CreateTime desc";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 获取民意调查详情
        //        /// <summary>
        //        /// 获取民意调查详情
        //        /// </summary>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录数</param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyQuestionNaireInfo(string Survey_id)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = string.Format(@" a.TopicID as 'Title_Id', a.SpecialID as 'Survey_id',a.TopicContent as 'content', a.OneOrMore as 'oneOrMore' ");
        //            table = " tblPartyQTopicInfo a ";
        //            where = string.Format(@" a.TopicState = 1 and a.SpecialID = '{0}'  ", Survey_id);
        //            orderBy = "a.OrderNo";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, 1, 10000);
        //        }
        //        #endregion

        //        #region 获取民意调查结果详情
        //        /// <summary>
        //        /// 获取民意调查详情
        //        /// </summary>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录数</param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyQuestionNaireResult(string Survey_id)
        //        {
        //            string sql = string.Format(@"select count(*) as c from tblPartyQTopicInfo where SpecialID = '{0}'
        //select TopicID as 'Title_Id',TopicContent  from tblPartyQTopicInfo where SpecialID = '{0}' and topicState = 1 order by OrderNo ", Survey_id);
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //        /// <summary>
        //        /// 获取民意调查详情
        //        /// </summary>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录数</param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyQuestionNaireResultOption(string Survey_id, string Title_Id)
        //        {
        //            string sql = string.Format(@"select count(*) as c from tblPartyQSubimtAnswer where TopicID = '{1}'
        //select OptionID,OptionContent from tblPartyQTopicOption where TopicID = '{1}'  order by OrderNo ", Survey_id, Title_Id);
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        /// <summary>
        //        /// 获取民意调查详情
        //        /// </summary>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录数</param>
        //        /// <returns></returns>
        //        public static DataSet GetPartyQuestionNaireResultOptionCount(string Title_Id, string OptionID)
        //        {
        //            string sql = string.Format(@"select count(*) as c from tblPartyQSubimtAnswer where TopicID = '{0}' and OptionID = '{1}'", Title_Id, OptionID);
        //            return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }

        //        #endregion

        //        #region 青年风采类表接口
        //        /// <summary>
        //        /// 青年风采类表接口
        //        /// </summary>
        //        /// <param name="branchID">组织Id</param>
        //        /// <param name="page_no">当前页</param>
        //        /// <param name="page_count">每页记录数</param>
        //        /// <returns></returns>
        //        public static DataSet GetYouthStyleList(string branchID, int page_no, int page_count)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = string.Format(@" a.ID, a.Title, a.BranchID, a.ImageID, a.ActivityTime, a.Content, a.CreateBy,om.UserName,ob.BranchName ");
        //            table = " tblPartyYouthStyle a left join tblPartyOrgMembers om on om.LoginID = a.CreateBy left join tblPartyOrgBranch ob on ob.BranchID = a.BranchID ";
        //            //if (string.IsNullOrEmpty(branchID) || branchID.Equals("D658070EC3BF425BA8417745FDCBFCB0"))
        //            //{
        //            where = " a.ShowInHomePage = 1 and a.Status = 1  ";
        //            //}
        //            //else
        //            //{
        //            //    where = string.Format(@"  a.Status = 1 and a.BranchID in (select ID from f_BranchID('{0}'))  ", branchID);
        //            //}
        //            orderBy = " a.IsImageFirst desc,a.SuperTop desc, a.IsTop desc,a.ActivityTime desc ";

        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 短信接收
        //        public static bool SaveSmsReceiveInfo(PartyMoSmsReceive smsReceive)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"insert into tblPartyMoSmsReceive(ID,MoID,ServiceNo,Mobile,RecContent,SendDetailID,RecTime,CreateTime)
        //                                        values(replace(newid(), '-', ''), @MoID,@ServiceNo,@Mobile,@RecContent,@SendDetailID,@RecTime,getdate()) ";

        //                cmd.Parameters.Add(new SqlParameter("@MoID", smsReceive.MoID));
        //                cmd.Parameters.Add(new SqlParameter("@ServiceNo", smsReceive.ServiceNo));
        //                cmd.Parameters.Add(new SqlParameter("@Mobile", smsReceive.Mobile));
        //                cmd.Parameters.Add(new SqlParameter("@RecContent", smsReceive.RecContent));
        //                cmd.Parameters.Add(new SqlParameter("@SendDetailID", smsReceive.SendDetailID));
        //                cmd.Parameters.Add(new SqlParameter("@RecTime", smsReceive.RecTime));

        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }

        //        public static string GetSMSSendID(string serviceNo)
        //        {
        //            if (string.IsNullOrEmpty(serviceNo))
        //            { return ""; }

        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"select a.TargetID from tblPartyMoExtNo a where a.ServiceNo = @ServiceNo ";
        //                cmd.Parameters.Add(new SqlParameter("@ServiceNo", serviceNo));

        //                object obj = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);

        //                if (obj == null)
        //                { return ""; }
        //                else
        //                { return obj.ToString(); }
        //            }
        //        }

        //        public static string GetSMSSendDetailID(string sendID, string mobileNo)
        //        {
        //            if (string.IsNullOrEmpty(sendID) || string.IsNullOrEmpty(mobileNo))
        //            { return ""; }

        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"select ID from tblPartyMoSmsSendDetail where SendID = @SendID and MobileNo = @MobileNo ";

        //                cmd.Parameters.Add(new SqlParameter("@SendID", sendID));
        //                cmd.Parameters.Add(new SqlParameter("@MobileNo", mobileNo));

        //                object obj = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);

        //                if (obj == null)
        //                { return ""; }
        //                else
        //                { return obj.ToString(); }
        //            }
        //        }

        //        /// <summary>
        //        /// 设置短信发送明细记录的回复状态
        //        /// </summary>
        //        /// <param name="id"></param>
        //        /// <returns></returns>
        //        public static bool SetSmsSendDetailIsReply(string id)
        //        {
        //            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(id))
        //            { return false; }

        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"update tblPartyMoSmsSendDetail set IsReply = '1' where ID = @ID ";

        //                cmd.Parameters.Add(new SqlParameter("@ID", id));

        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }

        //        /// <summary>
        //        /// 回收扩展码
        //        /// </summary>
        //        /// <param name="sendID"></param>
        //        /// <returns></returns>
        //        public static bool CallBackExtNo(string sendID)
        //        {
        //            if (string.IsNullOrEmpty(sendID))
        //            { return false; }

        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @" if not exists(select * from tblPartyMoSmsSendDetail where IsReply='0' and SendID = @SendID)
        //                                     begin
        //	                                    update tblPartyMoExtNo set TargetID = '' where TargetID=@SendID
        //                                     end";
        //                cmd.Parameters.Add(new SqlParameter("@SendID", sendID));

        //                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }
        //        #endregion
        //        #endregion

        //        #region 增加积分
        //        public static string ScoreManage(string category, string opType, string foreignID, string opUser, string opDesc, string paraEx)
        //        {
        //            int result = 0;
        //            string errMsg = "";
        //            try
        //            {
        //                using (SqlCommand cmd = new SqlCommand())
        //                {
        //                    //cmd.CommandText = string.Format(@"EXEC Sp_Score_DetailManage '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', 1",
        //                    //    category, opType, foreignID, opUser, opDesc, paraEx);

        //                    cmd.CommandText = "Sp_Score_DetailManage";
        //                    SqlParameter para1 = new SqlParameter("@Category", category);
        //                    SqlParameter para2 = new SqlParameter("@OpType", opType);
        //                    SqlParameter para3 = new SqlParameter("@ForeignID", foreignID);
        //                    SqlParameter para4 = new SqlParameter("@opUser", opUser);
        //                    SqlParameter para5 = new SqlParameter("@OpDesc", opDesc);
        //                    SqlParameter para6 = new SqlParameter("@ParaEx", paraEx);
        //                    SqlParameter para7 = new SqlParameter("@opResult", 1);

        //                    para7.Direction = ParameterDirection.Output;

        //                    cmd.Parameters.Add(para1);
        //                    cmd.Parameters.Add(para2);
        //                    cmd.Parameters.Add(para3);
        //                    cmd.Parameters.Add(para4);
        //                    cmd.Parameters.Add(para5);
        //                    cmd.Parameters.Add(para6);
        //                    cmd.Parameters.Add(para7);
        //                    cmd.CommandType = CommandType.StoredProcedure;

        //                    DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd, false);
        //                    result = Convert.ToInt32(para7.Value);
        //                }

        //            }
        //            catch (Exception ex)
        //            {
        //                result = 99;
        //                errMsg = ex.Message.Replace("'", "") + ":" + ex.StackTrace.Replace("'", "");
        //            }

        //            try
        //            {
        //                string sql = string.Format(@"INSERT INTO tblPartyObjectScoreLog
        //([ID],[Logtime],[Category],[OpType],[ForeignID]
        //,[opUser],[OpDesc],[ParaEx],[opResult],[LogDesc]
        //,[ColExOne],[ColExTwo])
        //VALUES (replace(newid(), '-',''), getdate(), '{0}','{1}','{2}',
        //'{3}','{4}','{5}','{6}','{7}',
        //'','')", category, opType, foreignID, opUser, opDesc, paraEx, result, errMsg);

        //                DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql);
        //            }
        //            catch
        //            {
        //            }

        //            switch (result)
        //            {
        //                case 0:
        //                    return "操作成功";
        //                case 1:
        //                    return "积分类型不正确";
        //                case 2:
        //                    return "当前积分人或所属组织不存在";
        //                case 3:
        //                    return "资料修改人或所属组织不存在"; //主要针对基础分-资料修改的判断
        //                case 4:
        //                    return "部分参数值不正确";
        //                case 5:
        //                    return "产生积分所对应的记录ID号不能为空";
        //                case 6:
        //                    return "当前记录不满足加分条件";
        //                case 7:
        //                    return "没有与当前党费缴纳记录对应的积分信息";
        //                case 8:
        //                    return "该积分已添加,不能重复加分";
        //                case 9:
        //                    return "积分已达上限";
        //                case 99:
        //                    return "操作异常:如果多次出现该信息，请联系管理员";
        //                default:
        //                    return "未知结果码：" + result.ToString();
        //            }
        //        }


        //        public static string ScoreManageZS(string category, string opType, string foreignID, string opUser, string opDesc, string paraEx)
        //        {
        //            int result = 0;
        //            string errMsg = "";
        //            try
        //            {
        //                using (SqlCommand cmd = new SqlCommand())
        //                {
        //                    //cmd.CommandText = string.Format(@"EXEC Sp_Score_DetailManage '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', 1",
        //                    //    category, opType, foreignID, opUser, opDesc, paraEx);

        //                    cmd.CommandText = "Sp_Score_DetailManage";
        //                    SqlParameter para1 = new SqlParameter("@Category", category);
        //                    SqlParameter para2 = new SqlParameter("@OpType", opType);
        //                    SqlParameter para3 = new SqlParameter("@ForeignID", foreignID);
        //                    SqlParameter para4 = new SqlParameter("@opUser", opUser);
        //                    SqlParameter para5 = new SqlParameter("@OpDesc", opDesc);
        //                    SqlParameter para6 = new SqlParameter("@ParaEx", paraEx);
        //                    SqlParameter para7 = new SqlParameter("@opResult", 1);

        //                    para7.Direction = ParameterDirection.Output;

        //                    cmd.Parameters.Add(para1);
        //                    cmd.Parameters.Add(para2);
        //                    cmd.Parameters.Add(para3);
        //                    cmd.Parameters.Add(para4);
        //                    cmd.Parameters.Add(para5);
        //                    cmd.Parameters.Add(para6);
        //                    cmd.Parameters.Add(para7);
        //                    cmd.CommandType = CommandType.StoredProcedure;

        //                    DBManager.DefaultDB.ExecuteNonQuery(cmd, false);
        //                    result = Convert.ToInt32(para7.Value);
        //                }

        //            }
        //            catch (Exception ex)
        //            {
        //                result = 99;
        //                errMsg = ex.Message.Replace("'", "") + ":" + ex.StackTrace.Replace("'", "");
        //            }

        //            try
        //            {
        //                string sql = string.Format(@"INSERT INTO tblPartyObjectScoreLog
        //([ID],[Logtime],[Category],[OpType],[ForeignID]
        //,[opUser],[OpDesc],[ParaEx],[opResult],[LogDesc]
        //,[ColExOne],[ColExTwo])
        //VALUES (replace(newid(), '-',''), getdate(), '{0}','{1}','{2}',
        //'{3}','{4}','{5}','{6}','{7}',
        //'','')", category, opType, foreignID, opUser, opDesc, paraEx, result, errMsg);

        //                DBManager.DefaultDB.ExecuteNonQuery(sql);
        //            }
        //            catch
        //            {
        //            }

        //            switch (result)
        //            {
        //                case 0:
        //                    return "操作成功";
        //                case 1:
        //                    return "积分类型不正确";
        //                case 2:
        //                    return "当前积分人或所属组织不存在";
        //                case 3:
        //                    return "资料修改人或所属组织不存在"; //主要针对基础分-资料修改的判断
        //                case 4:
        //                    return "部分参数值不正确";
        //                case 5:
        //                    return "产生积分所对应的记录ID号不能为空";
        //                case 6:
        //                    return "当前记录不满足加分条件";
        //                case 7:
        //                    return "没有与当前党费缴纳记录对应的积分信息";
        //                case 99:
        //                    return "操作异常:如果多次出现该信息，请联系管理员";
        //                default:
        //                    return "未知结果码：" + result.ToString();
        //            }
        //        }

        //        /// <summary>
        //        /// 增加在线测试积分
        //        /// </summary>
        //        /// <param name="testID">测试记录ID（必填）</param>
        //        /// <param name="testUserID">测试人（必填）</param>
        //        /// <param name="scoreDesc">积分描述</param>
        //        /// <returns></returns>
        //        public static string ScoreManagePartyOnlineTestAdd(string testID, string testUserID, string scoreDesc, string specialID = "")
        //        {
        //            if (string.IsNullOrEmpty(specialID))
        //            {
        //                return ScoreManage("PartyOnlineTest", "0", testID, testUserID, scoreDesc, testUserID);
        //            }
        //            else if (specialID.ToLower() == "qzlxjysj")
        //            {
        //                return ScoreManage("PartyOnlineTestEx", "0", testID, testUserID, scoreDesc, testUserID);
        //            }
        //            else if (specialID.ToLower() == "tjkc")
        //            {
        //                return ScoreManage("PartyOnlineTestTjkc", "0", testID, testUserID, scoreDesc, testUserID);
        //            }
        //            else if (specialID.ToLower() == "partyonlinetestfjzz")
        //            {
        //                return ScoreManage("PartyOnlineTestFjzz", "0", testID, testUserID, scoreDesc, "PartyOnlineTest-1");
        //            }
        //            else
        //            {
        //                return ScoreManage(specialID, "0", testID, testUserID, scoreDesc, "PartyOnlineTest-1");
        //            }
        //        }

        //        /// <summary>
        //        /// 增加登陆积分
        //        /// </summary>
        //        /// <param name="loginID">登陆ID（必填）</param> 
        //        /// <returns></returns>
        //        public static string ScoreManagePartyLoginAdd(string loginID)
        //        {
        //            return ScoreManage("BaseScoreLogin", "0", "", loginID, "", "");
        //        }

        //        /// <summary>
        //        /// 增加微信绑定积分
        //        /// </summary>
        //        /// <param name="loginID">登陆ID（必填）</param> 
        //        /// <returns></returns>
        //        public static string ScoreManagePartyWXBDAdd(string loginID)
        //        {
        //            return ScoreManage("PartyWXBD", "0", loginID, loginID, "", "");
        //        }

        //        /// <summary>
        //        /// 删除微信绑定积分
        //        /// </summary>
        //        /// <param name="loginID">登陆ID（必填）</param> 
        //        /// <returns></returns>
        //        public static string ScoreManagePartyWXBDDel(string loginID)
        //        {
        //            return ScoreManage("PartyWXBD", "1", loginID, loginID, "", "");
        //        }

        ///// <summary>
        ///// 增加登陆日志
        ///// </summary>
        ///// <param name="loginID">登陆ID（必填）</param> 
        ///// <returns></returns>
        //public static void InsertUserLoginLog(string loginID)
        //{
        //    try
        //    {
        //        string sql = string.Format(@"insert into tblUserLoginLog(ID,LoginID,LoginTime,source)
        //values(REPLACE(NEWID(), '-', ''), '{0}', GETDATE(), '手机')", loginID);

        //        DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql);
        //    }
        //    catch
        //    {
        //    }
        //}


        //        public static void AddScore(EnumScoreType scoreType, string scoreUserID, string ForumID, string des, string paraEx = "")
        //        {
        //            string scoreTypeStr = Enum.GetName(typeof(EnumScoreType), scoreType);
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                //cmd.CommandText = string.Format("exec [sp_Forum_ScoreManage] '{0}','{1}','{2}','{3}','{4}'", scoreUserID, scoreTypeStr,
        //                //    scoreUserID, des, ForumID);
        //                cmd.CommandText = "sp_Forum_ScoreManage";
        //                SqlParameter para1 = new SqlParameter("@ObjectID", string.IsNullOrEmpty(scoreUserID) ? "" : scoreUserID);
        //                SqlParameter para2 = new SqlParameter("@Category", string.IsNullOrEmpty(scoreTypeStr) ? "" : scoreTypeStr);
        //                SqlParameter para3 = new SqlParameter("@CreateBy", string.IsNullOrEmpty(scoreUserID) ? "" : scoreUserID);
        //                SqlParameter para5 = new SqlParameter("@ForeignID", string.IsNullOrEmpty(ForumID) ? "" : ForumID);
        //                SqlParameter para6 = new SqlParameter("@ParaEx", string.IsNullOrEmpty(paraEx) ? "" : paraEx);
        //                SqlParameter para7 = new SqlParameter("@opResult", 1);
        //                cmd.CommandType = CommandType.StoredProcedure;
        //                cmd.Parameters.Add(para1);
        //                cmd.Parameters.Add(para2);
        //                cmd.Parameters.Add(para3);
        //                //cmd.Parameters.Add(para4);
        //                cmd.Parameters.Add(para5);
        //                cmd.Parameters.Add(para6);
        //                cmd.Parameters.Add(para7);
        //                para7.Direction = ParameterDirection.Output;
        //                DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd);
        //            }
        //        }


        //        public enum EnumScoreType
        //        {
        //            Forum,
        //            Reply,
        //            /// <summary>
        //            /// 加精华
        //            /// </summary>
        //            Essence,
        //            /// <summary>
        //            /// 取消精华　
        //            /// </summary>
        //            CancelEssence,
        //            /// <summary>
        //            /// 删贴
        //            /// </summary>
        //            DeleteForum,
        //            /// <summary>
        //            /// 删回复
        //            /// </summary>
        //            DeleteReply
        //        }
        //        #endregion

        //        #region 其他系统接口
        //        #region 人员信息接口
        //        public static DataSet GetOrgMembersInfo(string beginTime)
        //        {
        //            string sql = string.Format(@"select * from(select a.UserID,b.UserName, b.BranchID, c.BranchName, b.Gender, b.IdentityCard,b.MobileNo,
        //d.StoragePath as ImageUrl, '0' as opType,b.PartyCardNo,a.ModifyTime as opDateTime
        //from tblOrgUser a inner join tblPartyOrgMembers b on a.LoginID=b.LoginID
        //left join tblPartyOrgBranch c on b.BranchID=c.BranchID
        //left join tblFiles d on b.ImageUrl=d.FileID
        //where a.ModifyTime >= '{0}' or a.CreateTime >='{0}'
        //union
        //select b.LoginID as UserID,b.UserName, b.BranchID, c.BranchName, b.Gender, b.IdentityCard,b.MobileNo,
        //d.StoragePath as ImageUrl, '1' as opType, '' as PartyCardNo ,b.DeleteTime as opDateTime
        //from tblPartyOrgMembersDelete b  
        //left join tblPartyOrgBranch c on b.BranchID=c.BranchID
        //left join tblFiles d on b.ImageUrl=d.FileID
        //where b.DeleteTime >= '{0}' ) aa order by opDateTime ", beginTime);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(sql);
        //        }
        //        #endregion

        //        #region 打卡机提交数据接口
        //        public static bool MachinePutSubmit(string MachineCode, string PutYear, string PutWeek, string PutPutDay, string LoginID, DateTime CreateTime)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                cmd.CommandText = @"EXEC dbo.sp_IF_MachinePut @MachineCode,@PutYear,@PutWeek,@PutPutDay,@LoginID,@CreateTime";
        //                cmd.Parameters.Add("@MachineCode", SqlDbType.VarChar).Value = MachineCode;
        //                cmd.Parameters.Add("@PutYear", SqlDbType.VarChar).Value = PutYear;
        //                cmd.Parameters.Add("@PutWeek", SqlDbType.VarChar).Value = PutWeek;
        //                cmd.Parameters.Add("@PutPutDay", SqlDbType.VarChar).Value = PutPutDay;
        //                cmd.Parameters.Add("@LoginID", SqlDbType.VarChar).Value = LoginID;
        //                cmd.Parameters.Add("@CreateTime", SqlDbType.VarChar).Value = CreateTime;
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //            }
        //        }
        //        #endregion

        //        #region 道一消息发送
        //        public static bool SendInfoDaoyi(string id, string publishTime, string source, string title, string type)
        //        {
        //            string sql = string.Format(@"insert into tblPartyPush(PushID,SourceID,CreateTime,CreateBy,Content,SourceType,Status,PushTarget)
        //                values(REPLACE(NEWID(), '-',''), '{0}', '{1}', '{2}', '{3}', '{4}','0','mobile_dy')", id, publishTime, source, title, type);

        //            return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(sql) > 0;
        //        }
        //        #endregion
        //        #endregion

        //        #region 增加推送
        //        /// <summary>
        //        /// 增加推送
        //        /// </summary>
        //        /// <param name="pushID"></param>
        //        /// <param name="sourceID"></param>
        //        /// <param name="sourceType"></param>
        //        /// <param name="operation"></param>
        //        /// <param name="pushTarget"></param>
        //        /// <param name="content"></param>
        //        /// <param name="imagesPath"></param>
        //        /// <param name="createBy"></param>
        //        /// <returns></returns>
        //        public static bool AddPushData(string sourceID, string sourceType, string sourceTable, string operation, string[] pushTarget, string content, string imagesPath, string createBy)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                string strSql = @"INSERT INTO tblPartyPush ([PushID],[SourceID],[SourceType],[SourceTable],[Operation],[PushTarget],[Content],[ImagesPath],[Status],[CreateTime],[CreateBy])
        //                                    VALUES (@PushID{0}, @SourceID, @SourceType,@SourceTable, @Operation, @PushTarget{0}, @Content, @ImagesPath, 0, GETDATE(), @CreateBy);";
        //                string[] pushTargetTemp = new string[] { "TV", "Map" };
        //                if (pushTarget != null && pushTarget.Length > 0)
        //                {
        //                    pushTargetTemp = pushTarget;
        //                }
        //                for (int i = 0; i < pushTargetTemp.Length; i++)
        //                {
        //                    string ID = StringHelper.NewID;
        //                    sbSql.AppendFormat(strSql, i);
        //                    cmd.Parameters.Add(string.Format("@PushTarget{0}", i), System.Data.SqlDbType.VarChar).Value = pushTargetTemp[i];
        //                    cmd.Parameters.Add(string.Format("@PushID{0}", i), System.Data.SqlDbType.VarChar).Value = ID;
        //                }
        //                cmd.Parameters.Add("@SourceID", System.Data.SqlDbType.VarChar).Value = sourceID;
        //                cmd.Parameters.Add("@SourceType", System.Data.SqlDbType.VarChar).Value = sourceType;
        //                cmd.Parameters.Add("@SourceTable", System.Data.SqlDbType.VarChar).Value = sourceTable;
        //                cmd.Parameters.Add("@Operation", System.Data.SqlDbType.VarChar).Value = operation;
        //                cmd.Parameters.Add("@Content", System.Data.SqlDbType.NVarChar).Value = content;
        //                cmd.Parameters.Add("@ImagesPath", System.Data.SqlDbType.VarChar).Value = imagesPath;
        //                cmd.Parameters.Add("@CreateBy", System.Data.SqlDbType.VarChar).Value = createBy;
        //                if (sbSql.Length > 0)
        //                {
        //                    cmd.CommandText = sbSql.ToString();
        //                    return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
        //                }
        //                else
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        #endregion

        //        #region 系统参数值

        //        /// <summary>
        //        /// 获取系统参数
        //        /// </summary>
        //        /// <param name="TypeValue"></param>
        //        /// <returns></returns>
        //        public static DataSet GetParametersValue(string TypeValue)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@" select * from tblSysSystemParameter where paraType=@paraType order by OrderNo ");
        //                cmd.Parameters.Add("@paraType", SqlDbType.NVarChar).Value = TypeValue;
        //                cmd.CommandText = sbsql.ToString();
        //                DataSet ds = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //                return ds;
        //            }
        //        }
        //        #endregion

        //        #region 中国梦游戏

        //        public static DataSet Get(string LoginID, string courseId)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append("select * from tblPartyStudyInfo where 1=1 ");
        //                if (!string.IsNullOrEmpty(LoginID))
        //                {
        //                    sbsql.Append(@" and userid=@userid");
        //                    cmd.Parameters.Add("@userid", SqlDbType.NVarChar).Value = LoginID;
        //                }
        //                if (!string.IsNullOrEmpty(courseId))
        //                {
        //                    sbsql.Append(@" and courseId=@courseId");
        //                    cmd.Parameters.Add("@courseId", SqlDbType.NVarChar).Value = courseId;
        //                }
        //                cmd.CommandText = sbsql.ToString();
        //                return DB.DBManager.DefaultDB.ExecuteDataSet(cmd);
        //            }
        //        }

        //        /// <summary>
        //        /// 检查数据是否存在
        //        /// </summary>
        //        /// <param name="Loginid"></param>
        //        /// <returns></returns>
        //        public static bool checkData(string Loginid, string courseId)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@"select * from tblPartyStudyInfo where 1=1");
        //                sbsql.Append(" and userid=@userid and courseId=@courseId");
        //                cmd.Parameters.Add("@userid", SqlDbType.NVarChar).Value = Loginid;
        //                cmd.Parameters.Add("@courseId", SqlDbType.NVarChar).Value = courseId;
        //                cmd.CommandText = sbsql.ToString();
        //                DataSet ds = DB.DBManager.DefaultDB.ExecuteDataSet(cmd);
        //                if (ds.Tables[0].Rows.Count > 0)
        //                { return true; }
        //                else return false;
        //            }
        //        }

        //        /// <summary>
        //        /// 插入数据
        //        /// </summary>
        //        /// <param name="LoginID"></param>
        //        /// <param name="courseId"></param>
        //        /// <param name="progress"></param>
        //        /// <param name="studyInfo"></param>
        //        /// <returns></returns>
        //        public static bool InsertZGMData(string LoginID, string courseId = "", string progress = "", string studyInfo = "")
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                if (string.IsNullOrEmpty(courseId))
        //                {
        //                    courseId = "";
        //                }
        //                if (string.IsNullOrEmpty(progress))
        //                {
        //                    progress = "";
        //                }
        //                if (string.IsNullOrEmpty(studyInfo))
        //                {
        //                    studyInfo = "";
        //                }
        //                sbsql.Append(@"INSERT INTO tblPartyStudyInfo
        //           ([userId]
        //           ,[courseId]
        //           ,[progress]
        //           ,[studyInfo],CreateTime)
        //     VALUES(@userId,@courseId,@progress,@studyInfo,@CreateTime)");
        //                cmd.Parameters.Add("@userId", SqlDbType.NVarChar).Value = LoginID;
        //                cmd.Parameters.Add("@courseId", SqlDbType.NVarChar).Value = courseId;
        //                cmd.Parameters.Add("@progress", SqlDbType.NVarChar).Value = progress;
        //                cmd.Parameters.Add("@studyInfo", SqlDbType.NVarChar).Value = studyInfo;
        //                cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime).Value = DateTime.Now;
        //                cmd.CommandText = sbsql.ToString();
        //                return DB.DBManager.DefaultDB.ExecuteNonQuery(cmd) > 0;
        //            }
        //        }

        //        /// <summary>
        //        /// 更新数据
        //        /// </summary>
        //        /// <param name="LoginID"></param>
        //        /// <param name="courseId"></param>
        //        /// <param name="progress"></param>
        //        /// <param name="studyInfo"></param>
        //        /// <returns></returns>
        //        public static bool UpdateZGMData(string LoginID, string courseId, string progress, string studyInfo)
        //        {

        //            using (SqlCommand cmd = new SqlCommand())
        //            {

        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@"update tblPartyStudyInfo set ");

        //                if (!string.IsNullOrEmpty(progress))
        //                {
        //                    sbsql.Append(" progress=case progress when 100 then 100 else @progress end,");
        //                    cmd.Parameters.Add("@progress", SqlDbType.NVarChar).Value = progress;
        //                }
        //                if (!string.IsNullOrEmpty(studyInfo))
        //                {
        //                    sbsql.Append(" studyInfo=@studyInfo,");
        //                    cmd.Parameters.Add("@studyInfo", SqlDbType.NVarChar).Value = studyInfo;
        //                }
        //                sbsql.Append(" ModifyTime=getdate() where userId=@userId   and courseId=@courseId ");
        //                cmd.Parameters.Add("@userId", SqlDbType.NVarChar).Value = LoginID;
        //                cmd.Parameters.Add("@courseId", SqlDbType.NVarChar).Value = courseId;

        //                cmd.CommandText = sbsql.ToString();
        //                return DB.DBManager.DefaultDB.ExecuteNonQuery(cmd) > 0;
        //            }
        //        }



        //        #endregion

        //        #region 妇儿之家

        //        /// <summary>
        //        /// 添加论点留言
        //        /// </summary>
        //        /// <param name="loginid"></param>
        //        /// <param name="content"></param>
        //        /// <returns></returns>
        //        public static bool AddHotLeaveMassage(string loginid, string content, string TutorHotID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@"INSERT INTO tblPartyWCHotLeaveMassage
        //                           ([LeaveMassageID]
        //                           ,[TutorHotID]
        //                           ,[Content]
        //                           ,[CreateBy]
        //                           ,[CreateTime]
        //                           )
        //                     VALUES(@LeaveMassageID,@TutorHotID,@Content,@CreateBy,@CreateTime)");
        //                    cmd.Parameters.Add("@LeaveMassageID", SqlDbType.NVarChar).Value = StringHelper.NewID;
        //                    cmd.Parameters.Add("@TutorHotID", SqlDbType.NVarChar).Value = TutorHotID;
        //                    cmd.Parameters.Add("@Content", SqlDbType.NVarChar).Value = content;
        //                    cmd.Parameters.Add("@CreateBy", SqlDbType.NVarChar).Value = loginid;
        //                    cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime).Value = DateTime.Now;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;

        //                    o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd);

        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }

        //        }

        //        /// <summary>
        //        /// 添加专家留言
        //        /// </summary>
        //        /// <param name="loginid"></param>
        //        /// <param name="content"></param>
        //        /// <returns></returns>
        //        public static bool AddDoctorLeaveMassage(string loginid, string content, string ExpertID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@"INSERT INTO tblPartyWCExpertLeaveMassage
        //           ([ExpertLeaveMassageID]
        //           ,[Content]
        //           ,[CreateBy]
        //           ,[CreateTime]
        //           ,[State]
        //           ,[ExpertID])
        //     VALUES(@ExpertLeaveMassageID,@Content,@CreateBy,@CreateTime,@State,@ExpertID)");
        //                    cmd.Parameters.Add("@ExpertLeaveMassageID", SqlDbType.NVarChar).Value = StringHelper.NewID;
        //                    cmd.Parameters.Add("@Content", SqlDbType.NVarChar).Value = content;
        //                    cmd.Parameters.Add("@CreateBy", SqlDbType.NVarChar).Value = loginid;
        //                    cmd.Parameters.Add("@State", SqlDbType.NVarChar).Value = "0";
        //                    cmd.Parameters.Add("@ExpertID", SqlDbType.NVarChar).Value = ExpertID;
        //                    cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime).Value = DateTime.Now;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;

        //                    o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd);

        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        /// <summary>
        //        /// 添加专家留言
        //        /// </summary>
        //        /// <param name="loginid"></param>
        //        /// <param name="content"></param>
        //        /// <returns></returns>
        //        public static bool UpdateDoctorLeaveMassageReply(string loginid, string content, string MassageID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@"update tblPartyWCExpertLeaveMassage
        //                                   set RContent=@RContent,State=1,RCreateTime=getdate()
        //                                   where ExpertLeaveMassageID=@ExpertLeaveMassageID ");
        //                    cmd.Parameters.Add("@ExpertLeaveMassageID", SqlDbType.NVarChar).Value = MassageID;
        //                    cmd.Parameters.Add("@RContent", SqlDbType.NVarChar).Value = content;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;

        //                    o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd);

        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        /// <summary>
        //        /// 判断专家是否存在
        //        /// </summary>
        //        /// <param name="ExpertsID"></param>
        //        /// <returns></returns>
        //        public static bool IsHaveDoctor(string ExpertsID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@" select count(*) from tblPartyWCExperts where ExpertsID=@ExpertsID");
        //                    cmd.Parameters.Add("@ExpertsID", SqlDbType.NVarChar).Value = ExpertsID;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;

        //                    o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);

        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }
        //        }

        //        /// <summary>
        //        /// 判断咨询是否存在
        //        /// </summary>
        //        /// <param name="ExpertsID"></param>
        //        /// <returns></returns>
        //        public static bool IsHaveDoctorMessage(string MessageID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@" select count(*) from tblPartyWCExpertLeaveMassage where ExpertLeaveMassageID=@ExpertLeaveMassageID");
        //                    cmd.Parameters.Add("@ExpertLeaveMassageID", SqlDbType.NVarChar).Value = MessageID;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;

        //                    o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);

        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        /// <summary>
        //        /// 判断论点是否存在
        //        /// </summary>
        //        /// <param name="ExpertsID"></param>
        //        /// <returns></returns>
        //        public static bool IsHaveHot(string TutorHotID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                try
        //                {
        //                    StringBuilder sbsql = new StringBuilder();
        //                    sbsql.Append(@" select count(*) from tblPartyWCTutorHot where TutorHotID=@TutorHotID");
        //                    cmd.Parameters.Add("@TutorHotID", SqlDbType.NVarChar).Value = TutorHotID;
        //                    cmd.CommandText = sbsql.ToString();
        //                    object o;

        //                    o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);

        //                    if (o != null)
        //                    {
        //                        if (o.ToInt() > 0)
        //                            return true;
        //                        else return false;
        //                    }
        //                    else return false;
        //                }
        //                catch (Exception)
        //                {
        //                    return false;
        //                }
        //            }
        //        }
        //        #endregion

        //        #region 人才测评增加积分
        //        /// <summary>
        //        /// 检查是否存在
        //        /// </summary>
        //        /// <param name="foreignID">产品ID</param>
        //        /// <param name="UserID">用户ID</param>
        //        /// <returns></returns>
        //        public static bool CheckIsHave(string foreignID, string UserID)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@"select COUNT(*) as cou from tblPartyObjectScore where ForeignID=@ForeignID  and ObjectID=@ObjectID ");
        //                cmd.Parameters.Add("@ObjectID", SqlDbType.NVarChar).Value = UserID;
        //                cmd.Parameters.Add("@ForeignID", SqlDbType.NVarChar).Value = foreignID;
        //                cmd.CommandText = sbsql.ToString();
        //                object o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd);
        //                if (o.ToInt() > 0)
        //                    return false;
        //                else return true;
        //            }
        //        }

        //        /// <summary>
        //        /// 倍智仁才加分
        //        /// </summary>
        //        /// <param name="foreignID">产品ID</param>
        //        /// <param name="UserID">用户ID</param>
        //        /// <param name="category">类型</param>
        //        /// <param name="defalutDesc">说明</param>
        //        /// <returns></returns>
        //        public static string InsertAddScore(string foreignID, string UserID, string category, string defalutDesc)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@"INSERT INTO [tblPartyObjectScore]
        //                               ([ScoreID]
        //                               ,[ObjectID]
        //                               ,[ObjectType]
        //                               ,[ScoreDate]
        //                               ,[Category]
        //                               ,[Score]
        //                               ,[Description]
        //                               ,[SourceType]
        //                               ,[CreateBy]
        //                               ,[CreateTime]
        //                               ,[ForeignID]
        //                               ,[DescriptionEx]
        //                               ,[ScoreType])
        //               VALUES(@ScoreID,@ObjectID,@ObjectType,@ScoreDate,@Category,@Score,@Description,@SourceType,@CreateBy,@CreateTime,@ForeignID,@DescriptionEx,@ScoreType)");
        //                cmd.Parameters.Add("@ScoreID", SqlDbType.NVarChar).Value = StringHelper.NewID;
        //                cmd.Parameters.Add("@ObjectID", SqlDbType.NVarChar).Value = UserID;
        //                cmd.Parameters.Add("@ObjectType", SqlDbType.NVarChar).Value = "Member";
        //                cmd.Parameters.Add("@ScoreDate", SqlDbType.DateTime).Value = DateTime.Now;
        //                cmd.Parameters.Add("@Category", SqlDbType.NVarChar).Value = category;
        //                cmd.Parameters.Add("@Score", SqlDbType.Decimal).Value = 5;
        //                cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = defalutDesc;
        //                cmd.Parameters.Add("@SourceType", SqlDbType.NVarChar).Value = "Auto";
        //                cmd.Parameters.Add("@CreateBy", SqlDbType.NVarChar).Value = UserID;
        //                cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime).Value = DateTime.Now;
        //                cmd.Parameters.Add("@ForeignID", SqlDbType.NVarChar).Value = foreignID;
        //                cmd.Parameters.Add("@DescriptionEx", SqlDbType.NVarChar).Value = "";
        //                cmd.Parameters.Add("@ScoreType", SqlDbType.NVarChar).Value = "";
        //                cmd.CommandText = sbsql.ToString();
        //                object o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd);
        //                if (o.ToInt() == 1)
        //                {
        //                    return "加分成功";
        //                }
        //                else
        //                    return "加分失败，请检查数据，多次出现请联系管理员。";
        //            }
        //        }
        //        #endregion

        //        #region 获取人员及组织信息
        //        /// <summary>
        //        /// 获取人员信息
        //        /// </summary>
        //        /// <param name="BranchID"></param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetSystemUsersData(string LoginID, string ModifyTime, int page_no, int page_count, string CreateTime)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = " *";
        //            table = " tblPartyOrgMembers ";
        //            if (!string.IsNullOrEmpty(LoginID))
        //            {
        //                where = " LoginID='" + LoginID + "'";
        //            }
        //            if (!string.IsNullOrEmpty(ModifyTime))
        //            {
        //                where += "  ModifyTimeEx>'" + ModifyTime + "'";
        //            }
        //            if (!string.IsNullOrEmpty(CreateTime))
        //            {
        //                where += "  CreateTime>'" + CreateTime + "'";
        //            }
        //            if (!string.IsNullOrEmpty(LoginID) && !string.IsNullOrEmpty(ModifyTime))
        //            {
        //                where = " 1=1";
        //            }
        //            orderBy = " OrderNo";
        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }

        //        /// <summary>
        //        /// 获取组织信息
        //        /// </summary>
        //        /// <param name="BranchID"></param>
        //        /// <param name="page_no"></param>
        //        /// <param name="page_count"></param>
        //        /// <returns></returns>
        //        public static DataSet GetSystemBranchData(string BranchID, string ModifyTime, int page_no, int page_count, string CreateTime)
        //        {
        //            string field = string.Empty;
        //            string table = string.Empty;
        //            string where = string.Empty;
        //            string orderBy = string.Empty;

        //            field = " *";
        //            table = " tblPartyOrgBranch ";
        //            if (!string.IsNullOrEmpty(BranchID))
        //            {
        //                where += " BranchID='" + BranchID + "'";
        //            }
        //            if (!string.IsNullOrEmpty(ModifyTime))
        //            {
        //                where += "  ModifyTimeEx>'" + ModifyTime + "'";
        //            }
        //            if (!string.IsNullOrEmpty(CreateTime))
        //            {
        //                where += "  CreateTimeEx>'" + CreateTime + "'";
        //            }
        //            if (!string.IsNullOrEmpty(BranchID) && !string.IsNullOrEmpty(ModifyTime))
        //            {
        //                where = " 1=1";
        //            }
        //            orderBy = " OrderNo";
        //            return CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count);
        //        }
        //        #endregion

        //        #region 领导驻点
        //        public static bool LdzdCheckItemID(string itemid)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                string sqlName = " select count(ItemID) from tblGrassrootsGroupItem where ItemID =@ItemID";
        //                cmd.Parameters.Add("@ItemID", SqlDbType.NVarChar).Value = itemid;
        //                cmd.CommandText = sqlName;
        //                return Convert.ToInt32(DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteScalar(cmd)) > 0;
        //            }
        //        }

        //        /// <summary>
        //        /// 新增心声传递
        //        /// </summary>
        //        /// <param name="item_id"></param>
        //        /// <param name="login_id"></param>
        //        /// <param name="mobileno"></param>
        //        /// <param name="title"></param>
        //        /// <param name="content"></param>
        //        /// <returns></returns>
        //        public static bool LdzdCreateMassesVoice(string item_id, string login_id, string mobileno, string title, string content)
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbsql = new StringBuilder();
        //                sbsql.Append(@"insert tblGrassrootsSuggestion 
        //            (SuggestionID,ItemID,UserName,SuggestionBy,Title,MobileNo,Content,CreateBy,CreateTime)
        //            values (@SuggestionID,
        //                       @ItemID,
        //                        @UserName,
        //                        @SuggestionBy,
        //                        @Title,
        //                        @MobileNo,
        //                       @Content,
        //                        @CreateBy,
        //                       getdate()) ");
        //                cmd.Parameters.Add("@SuggestionID", SqlDbType.NVarChar).Value = StringHelper.NewID;
        //                cmd.Parameters.Add("@ItemID", SqlDbType.NVarChar).Value = item_id;
        //                cmd.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = SXT.Party.Utility.PartyOrg.QueryMemberName(login_id);
        //                cmd.Parameters.Add("@SuggestionBy", SqlDbType.NVarChar).Value = login_id;
        //                cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = title;
        //                cmd.Parameters.Add("@MobileNo", SqlDbType.NVarChar).Value = mobileno;
        //                cmd.Parameters.Add("@Content", SqlDbType.NVarChar).Value = content;
        //                cmd.Parameters.Add("@CreateBy", SqlDbType.NVarChar).Value = login_id;
        //                cmd.CommandText = sbsql.ToString();
        //                object o = DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd);
        //                if (o.ToInt() == 1)
        //                {
        //                    return true;
        //                }
        //                else
        //                    return false;
        //            }
        //        }


        //        /// <summary>
        //        /// 获取GetDataGrid数据源(分页)
        //        /// </summary>
        //        /// <returns></returns>
        //        public static DataSet LdzdGetGridDataPage(int pageIndex, int pageSize, string itemid="",string suggestionid="", string loginid= "")
        //        {
        //            using (SqlCommand cmd = new SqlCommand())
        //            {
        //                StringBuilder sbSql = new StringBuilder();
        //                sbSql.Append(@"select  ROW_NUMBER() OVER(ORDER BY  Data.createtime desc) as RowNumber,data.SuggestionBy,om.UserName as CUserName,
        //om2.UserName as MUserName,GI.ItemName, data.SuggestionID,
        //data.ItemID,data.SerialNumber,data.UserName,data.Title,data.MobileNo,G.GroupName,data.GrassrootsAdmin,
        //data.WorkUnit,data.Post,data.Content,data.MessageWay,data.MassComment,data.Status,
        //data.Reply,data.Gender,data.Age,data.Address,data.Zip,data.PoliticsLineament,
        //data.CreateBy,data.CreateTime,data.ModifyBy,data.ModifyTime 
        //into #temp 
        //from tblGrassrootsSuggestion data 
        //left join tblGrassrootsGroupItem GI on data.ItemID=GI.ItemID 
        //left join tblGrassrootsGroup G on G.GroupID=GI.GroupID 
        //left join tblPartyOrgMembers om on data.CreateBy=om.LoginID 
        //left join tblPartyOrgMembers om2 on data.ModifyBy=om2.LoginID

        //where 1=1 ");

        //                if (!string.IsNullOrEmpty(itemid))
        //                {
        //                    sbSql.Append(" and Data.itemid = @itemid ");
        //                    cmd.Parameters.Add("@itemid", SqlDbType.NVarChar).Value = itemid;
        //                }
        //                if (!string.IsNullOrEmpty(suggestionid))
        //                {
        //                    sbSql.Append(" and Data.suggestionid = @suggestionid ");
        //                    cmd.Parameters.Add("@suggestionid", SqlDbType.NVarChar).Value = suggestionid;
        //                }
        //                if (!string.IsNullOrEmpty(loginid))
        //                {
        //                    sbSql.Append(" and Data.SuggestionBy = @loginid ");
        //                    cmd.Parameters.Add("@loginid", SqlDbType.VarChar).Value = loginid;
        //                }
        //                sbSql.Append(@"SELECT * FROM #temp WHERE #temp.RowNumber BETWEEN @RowStart AND @RowEnd; ");
        //                sbSql.Append(" select Count(1) from #temp ");
        //                cmd.Parameters.Add("@RowStart", SqlDbType.Int).Value = ((pageIndex - 1) * pageSize + 1);
        //                cmd.Parameters.Add("@RowEnd", SqlDbType.Int).Value = (pageIndex * pageSize);
        //                cmd.CommandText = sbSql.ToString();
        //                return DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
        //            }
        //        }
        //        #endregion
    }
}